Electronic device accessory with ultrasonic tone generator

ABSTRACT

Electronic devices and accessories such as headsets for electronic devices are provided. A microphone may be included in an accessory to capture sound for an associated electronic device. Buttons and other user interfaces may be included in the accessories. An accessory may have an audio plug that connects to a mating audio jack in an electronic device, thereby establishing a wired communications link between the accessory and the electronic device. The electronic device may include power supply circuitry for applying bias voltages to the accessory. The bias voltages may bias a microphone and may adjust settings in the accessory such as settings related to operating modes. User input information may be conveyed between the accessory and the electronic device using ultrasonic tone transmission. The electronic device may also gather input from the accessory using a voltage detector coupled to lines in the communications path.

This application claims the benefit of provisional patent applicationNo. 61/020,988, filed Jan. 14, 2008, which is hereby incorporated byreference herein in its entirety.

BACKGROUND

This invention relates to electronic devices and accessories forelectronic devices.

Electronic devices such as computers, media players, and cellulartelephones typically contain audio jacks. Accessories such as headsetshave mating plugs. A user who desires to use a headset with anelectronic device may connect the headset to the electronic device byinserting the headset plug into the mating audio jack on the electronicdevice. Miniature size (3.5 mm) phone jacks and plugs are commonly usedelectronic devices such as notebook computers and media players, becauseaudio connectors such as these are relatively compact.

Stereo audio connectors typically have three contacts. The outermost endof an audio plug is typically referred to as the tip. The innermostportion of the plug is typically referred to as the sleeve. A ringcontact lies between the tip and the sleeve. When using thisterminology, stereo audio connectors such as these are sometimesreferred to as tip-ring-sleeve (TRS) connectors. The sleeve can serve asground. The tip contact can be used in conjunction with the sleeve tohandle a left audio channel and the ring contact can be used inconjunction with the sleeve to handle the right channel of audio.

In devices such as cellular telephones, it is often necessary to conveymicrophone signals from the headset to the cellular telephone. Inarrangements in which it is desired to handle both stereo audio signalsand microphone signals, an audio connector typically contains anadditional ring terminal. Audio connectors such as these have a tip, tworings, and a sleeve and are therefore sometimes referred to asfour-contact connectors or TRRS connectors. When a four-contactconnector is used, the sleeve or one of the rings may serve as ground.The tip contact and the outermost ring contact may be used inconjunction with the ground to carry audio for the left and rightheadset speaker audio channels. The remaining contact (e.g., the sleevecontact) may be used in conjunction with the ground to carry microphonesignals.

In a typical microphone-enabled headset, a bias voltage is applied tothe microphone from the electronic device over the microphone line. Themicrophone in the headset generates a microphone signal when sound isreceived from the user (i.e., when a user speaks during a telephonecall). Microphone amplifier circuitry and analog-to-digital convertercircuitry in the cellular telephone can convert microphone signals fromthe headset into digital signals for subsequent processing.

Some users may wish to operate their cellular telephones or otherelectronic devices remotely. To accommodate this need, some modernmicrophone-enabled headsets feature a button. When the button is pressedby the user, the microphone line is shorted to ground. Monitoringcircuitry in a cellular telephone to which the headset is connected candetect the momentary grounding of the microphone line and can takeappropriate action. In a typical scenario, a button press might be usedbe used to answer an incoming telephone or might be used skip tracksduring playback of a media file.

Conventional button arrangements such as these offer limitedfunctionality and may introduce undesirable clicking noises if thebutton is actuated during normal use of the microphone.

It would therefore be desirable to be able to provide improvedarrangements for supporting interactions between electronic devices andaccessories such as headsets.

SUMMARY

Electronic devices and accessories for electronic devices are provided.The electronic devices may be computers, handheld computing devices suchas smart cellular telephones or media players, or any other suitablecomputing equipment. These devices typically generate audio signals. Theaudio signals may be used to drive speakers in accessories such asheadsets and other equipment capable of presenting sound to a user.

Some electronic devices support operations that involve gathering soundinput with a microphone. Accessories with microphones may be used tosupply microphone signals to electronic devices with audio inputcapabilities. For example, accessories with microphones may be used tosupply voice signals to a cellular telephone in connection with cellulartelephone calls or may be used to supply audio when an audio clip isbeing recorded by a voice memo application on a device. Speakers may beused to play media files, sound from telephone call, or other suitableaudio information.

It may be desirable to gather user input with a user input interfacethat is part of an accessory (i.e., a stand-alone accessory or anadapter). With this type of arrangement, buttons, a touch pad, a touchscreen, or other user input interface equipment may be used at theaccessory to gather user input. Resistively encoded buttons may be usedto gather user input. An impedance detector may be used in the accessoryto determine which of the resistively encoded buttons has been pressed.Button activity may also be monitored directly by the electronic deviceusing voltage detection circuitry. The accessory may have an ultrasonictone generator that conveys ultrasonic tones in response to user inputactivity such as button press activity. The electronic device may have atone detector that monitors the user input by receiving and processingthe ultrasonic tones. The user input may be used to adjust the functionsof the electronic device such as media playback functions, cellulartelephone operations, and other suitable functions.

If desired, user input can be conveyed from the accessory to theelectronic device as ultrasonic tones using a microphone line and groundline that are also being used to convey audio information. For example,in an accessory with buttons, information on button actuation events canbe transmitted as ultrasonic signals at the same time that analogmicrophone signals are conveyed from the accessory to a correspondingamplifier in the electronic device.

Ultrasonic tones are not audible to humans, so they can be carried overthe microphone and ground path without resulting in audible microphoneinterference. This allows a user to convey button actuation activity tothe electronic device at the same time that the user carries on atelephone call using the microphone in the accessory. Microphone signalscorresponding to the user's voice may be conveyed to the electronicdevice, while simultaneously conveying button press data to theelectronic device. Both analog microphone signals and ultrasonic buttonactuation data may be transmitted from the accessory to the electronicdevice simultaneously. The ultrasonic signals will not be audible asaudio signals and therefore will not interfere with other audio signalssuch as music or voice signals.

The buttons that are used to produce the ultrasonic signals may beresistively-encoded buttons that provide button press data to a tonegenerator. The tone generator may, in turn, transmit correspondingultrasonic tones to the electronic device. These buttons need not shortthe microphone and ground lines together. As a result, the microphoneand ground lines can be left undisturbed by shorting events duringbutton presses. This helps allow a user to make button presses at thesame time that the user is carrying on a telephone call. In this type ofconfiguration, button presses are used to control the tone generator andwill not short the microphone and ground lines together. Shorting eventswill therefore not interrupt a telephone call. The ultrasonic tones thatare produced by the tone generator in response to the button presses canbe conveyed over the microphone and ground lines during the telephonecall, but will not be audible to the user because they fall outside therange of human hearing.

Further features of the invention, its nature and various advantageswill be more apparent from the accompanying drawings and the followingdetailed description of the preferred embodiments.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a schematic diagram of an illustrative electronic device incommunication with an accessory such as a headset and other externalequipment in a system in accordance with an embodiment of the presentinvention.

FIG. 2 is a perspective view of an illustrative electronic device suchas a portable computer with an audio connector that mates withaccessories such as headsets in accordance with an embodiment of thepresent invention.

FIG. 3 is a perspective view of an illustrative handheld electronicdevice such as a media player, cellular telephone, or hybrid deviceshowing how the handheld electronic device may have an audio connectorthat mates with accessories such as headsets in accordance with anembodiment of the present invention.

FIG. 4 is a cross-sectional side view of illustrative three-contact andfour-contact audio connectors that may be used in accordance withembodiments of the present invention.

FIG. 5 is a perspective view of an illustrative accessory such as aheadset that may be provided with a user input interface such asinput-output circuitry containing multiple user-selectable buttons inaccordance with an embodiment of the present invention.

FIG. 6 is perspective view of an illustrative accessory such as aheadset that has been connected to an adapter accessory having an inputinterface such as an interface with multiple user-selectable buttons inaccordance with an embodiment of the present invention.

FIG. 7 is a schematic diagram showing illustrative circuitry that may beused in an electronic device and an associated accessory in accordancewith embodiments of the present invention.

FIG. 8 is a flow chart of illustrative steps involved in using anelectronic device and accessory in accordance with an embodiment of thepresent invention.

FIG. 9 is a circuit diagram of an illustrative accessory such as aheadset having two speakers in accordance with an embodiment of thepresent invention.

FIG. 10 is a circuit diagram showing illustrative circuitry that may beused to drive audio signals from an electronic device onto associatedspeaker paths in an accessory such as a headset in accordance with anembodiment of the present invention.

FIG. 11 is a circuit diagram of an illustrative accessory such as aheadset having two speakers, a microphone, and a switch associated witha button in accordance with an embodiment of the present invention.

FIG. 12 is a circuit diagram showing illustrative circuitry that may beused to handle microphone signals and control signals received from anaccessory such as the headset of FIG. 11 and that may be used to driveaudio signals onto associated speaker paths in the accessory inaccordance with an embodiment of the present invention.

FIG. 13 is a flow chart of illustrative steps involved in using anelectronic device and accessory such as a headset with a microphone andassociated button in accordance with an embodiment of the presentinvention.

FIG. 14 is a circuit diagram of an illustrative accessory such asheadset that may have one or more buttons or other user interfaceequipment for producing encoded resistance values that are processed byan associated electronic device that has resistance detectioncapabilities in accordance with an embodiment of the present invention.

FIG. 15 is a circuit diagram of illustrative circuitry that may be usedin an electronic device to provide audio signals to speakers in anaccessory such as a headset and that may be used to implement resistancedetection capabilities for decoding resistively encoded user input suchas button actuation events made using buttons in an accessory of thetype shown in FIG. 14 in accordance with an embodiment of the presentinvention.

FIG. 16 is a circuit diagram of an illustrative accessory such as aheadset having resistively encoded buttons and an optional button thatshorts two contacts in a four-contact audio connector together when theoptional button is actuated in accordance with an embodiment of thepresent invention.

FIG. 17 is a flow chart of illustrative steps involved in decodingresistively encoded button actuation events or other user control eventssupplied by a user with an accessory such as a headset in accordancewith an embodiment of the present invention.

FIG. 18 is a circuit diagram of an illustrative accessory such as aheadset in which a user interface gathers user input and in whichcontrol circuitry such as tone-generator-based control circuitry assistsin conveying the user input to a corresponding electronic device inaccordance with an embodiment of the present invention.

FIG. 19 is a circuit diagram of an illustrative user input device suchas a set of resistively encoded button switches or other controls andassociated processing circuitry such as an impedance detector that maybe used in an accessory such as a headset in accordance with anembodiment of the present invention.

FIG. 20 is a circuit diagram of illustrative input interface and controlcircuitry that may be used to process user input in an accessory such asa headset in accordance with an embodiment of the present invention.

FIG. 21 is a circuit diagram of illustrative circuitry that may be usedin an electronic device in receiving and processing control signals suchas tone-based-control signals from a headset or other accessory inaccordance with an embodiment of the present invention.

FIG. 22 is a flow chart of illustrative steps involved in using anelectronic device and accessory that communicate with one another usingtone-based signaling or other suitable communications techniques inaccordance with an embodiment of the present invention.

FIG. 23 is a diagram showing how different types of accessories may beused with different types of electronic devices in accordance withembodiments of the present invention.

FIG. 24 is a circuit diagram of illustrative circuitry that may be usedin an electronic device to interface with an accessory such as a headsetthat includes tone-based encoder circuitry for encoding user input inaccordance with an embodiment of the present invention.

FIG. 25 is a circuit diagram of an illustrative adjustable power supplycircuit that may be used to produce a controllable bias for a microphoneline or other conductor associated with an accessory such as a headsetin accordance with an embodiment of the present invention.

FIG. 26 is a circuit diagram of an illustrative circuit that may be usedfor monitoring the voltage of a signal from an accessory such as aheadset on a conductive path such as a microphone line in accordancewith an embodiment of the present invention.

FIG. 27 is a table showing illustrative registers that may be used in anelectronic device to store information associated with interactionsbetween the electronic device and an accessory such as a headset inaccordance with an embodiment of the present invention.

FIG. 28 is a circuit diagram of illustrative circuitry that may be usedin an accessory such as a headset to process user input and to supplycorresponding tone-encoded signals to a corresponding electronic devicein accordance with an embodiment of the present invention.

FIG. 29 is a table showing illustrative states in which an illustrativeset of switches may be placed by control circuitry in variousaccessories during different modes of operation in accordance withembodiments of the present invention.

FIG. 30 is a circuit diagram of illustrative circuitry that may be usedin an accessory such as a headset to process user input and to supplycorresponding tone-encoded signals to a corresponding electronic devicein accordance with an embodiment of the present invention.

FIG. 31 is another circuit diagram of illustrative circuitry that may beused in an accessory such as a headset to process user input and tosupply corresponding tone-encoded signals to a corresponding electronicdevice in accordance with an embodiment of the present invention.

FIG. 32 is a graph showing illustrative tones that may be conveyedbetween an accessory such as a headset and an electronic device when theaccessory and electronic device are communicating in accordance with anembodiment of the present invention.

FIG. 33 is an illustrative table showing tone frequencies that may beused in a tone-based scheme for supporting communications between anaccessory such as a headset and an electronic device in accordance withan embodiment of the present invention.

FIG. 34 is a circuit diagram of an illustrative tone detector that maybe used in circuitry such as circuitry on an electronic device toprocess incoming tones from an accessory such as a headset in accordancewith an embodiment of the present invention.

FIG. 35 is a diagram illustrating how tones may be processed by a tonegenerator of the type shown in FIG. 33 in accordance with an embodimentof the present invention.

FIG. 36 is a flow chart of illustrative operations involved in handlingtone-based communications between an accessory such as a headset and anelectronic device in accordance with an embodiment of the presentinvention.

FIG. 37 is a flow chart of illustrative operations involved indetermining what type of accessory is connected to an electronic devicein accordance with an embodiment of the present invention.

FIG. 38 is a chart showing illustrative actions that may be taken in anelectronic device in response to user input such as user input suppliedto an accessory that is connected to the electronic device in accordancewith embodiments of the present invention.

FIG. 39 is a chart showing additional illustrative actions that may betaken in an electronic device in response to user input such as userinput supplied to an accessory that is connected to the electronicdevice in accordance with embodiments of the present invention.

FIG. 40 is a circuit diagram of illustrative circuitry that may be usedin an accessory such as a headset without a microphone to process userinput and to supply corresponding tone-encoded signals to acorresponding electronic device in accordance with an embodiment of thepresent invention.

FIG. 41 is a circuit diagram of illustrative circuitry withoutmicrophone line shorting buttons that may be used in an accessory suchas a headset to process user input and to supply correspondingtone-encoded signals to a corresponding electronic device in accordancewith an embodiment of the present invention.

DETAILED DESCRIPTION

The present invention relates generally to electronic devices andaccessories for electronic devices.

The electronic devices may be, for example, devices such as desktopcomputers or portable electronic devices such as laptop computers orsmall portable computers of the type that are sometimes referred to asultraportables. The electronic devices may also be somewhat smallerportable electronic devices such as wrist-watch devices, pendantdevices, and other wearable and miniature devices. If desired, theelectronic devices may include wireless capabilities.

The electronic devices may be handheld electronic devices such ascellular telephones, media players with wireless communicationscapabilities, handheld computers (also sometimes called personal digitalassistants), remote controllers, global positioning system (GPS)devices, and handheld gaming devices. The electronic devices may also behybrid devices that combine the functionality of multiple conventionaldevices. Examples of hybrid electronic devices include a cellulartelephone that includes media player functionality, a gaming device thatincludes a wireless communications capability, a cellular telephone thatincludes game and email functions, and a portable device that receivesemail, supports mobile telephone calls, has music player functionalityand supports web browsing. These are merely illustrative examples.

An example of an accessory that may be used with an electronic device isa headset. A headset typically includes a pair of speakers that a usercan use to play audio from the electronic device. The accessory may havea user control interface such as one or more buttons. When a usersupplies input, the input may be conveyed to the electronic device. Asan example, when the user presses a button on the accessory, acorresponding signal may be provided to the electronic device to directthe electronic device to take an appropriate action. Because the buttonis located on the headset rather than on the electronic device, a usermay place the electronic device at a remote location such as on a tableor in a pocket, while controlling the device using conveniently locatedheadset buttons.

If the electronic device is a media player and is in the process ofplaying a song or other media file for the user, the electronic devicemay be directed to pause the currently playing media file when the userpresses a button. As another example, if the electronic device is acellular telephone with media player capabilities and the user islistening to a song when an incoming telephone call is received,actuation of the button by the user may direct the electronic device toanswer the incoming telephone call. Actions such as these may be taken,for example, while the media player or cellular telephone is stowedwithin a user's pocket.

Accessories such as headsets are typically connected to electronicdevices using audio plugs (male audio connectors) and mating audio jacks(female audio connectors). Audio connectors such as these may beprovided in a variety of form factors. Most commonly, audio connectorstake the form of 3.5 mm (⅛″) miniature plugs and jacks. Other sizes arealso sometimes used such as 2.5 mm subminiature connectors and ¼ inchconnectors. In the context of accessories such as headsets, these audioconnectors and their associated cables are generally used to carryanalog signals such as audio signals for speakers and microphonesignals. Digital connectors such as universal serial bus (USB) andFirewire® (IEEE 1394) connectors may also be used by electronic devicesto connect to external equipment such as headsets, but it is generallypreferred to connect headsets to electronic devices using standard audioconnectors such as the 3.5 mm audio connector. Digital connectors suchas USB connectors and IEEE 1394 connectors are primarily of use wherelarge volumes of digital data need to be transferred with externalequipment such as when connecting to a peripheral device such as aprinter. Optical connectors, which may be integrated with digital andanalog connectors, may be used to convey data between an electronicdevice and an associated accessory, particularly in environments thatcarry high bandwidth traffic such as video traffic. If desired, audioconnectors may include optical communications structures to support thistype of traffic.

An illustrative system in accordance with an embodiment of the presentinvention is shown in FIG. 1. As shown in FIG. 1, system 10 may includean electronic device such as electronic device 12 and an accessory suchas accessory 14. A path such as path 16 may be used to connectelectronic device 12 and accessory 14. In a typical arrangement, path 16includes one or more audio connectors such as 3.5 mm plugs and jacks oraudio connectors of other suitable sizes. Conductive lines in path 16may be used to convey signals over path 16. There may, in general, beany suitable number of lines in path 16. For example, there may be two,three, four, five, or more than five separate lines. These lines may bepart of one or more cables. Cables may include solid wire, strandedwire, shielding, single ground structures, multi-ground structures,twisted pair structures, or any other suitable cabling structures.Extension cord and adapter arrangements may be used as part of path 16if desired. In an adapter arrangement, some of the features of accessory14 such as user interface and communications functions may be providedin the form of an adapter accessory with which an auxiliary accessorysuch as a headset may be connected to device 12.

Accessory 14 may be any suitable device that works in conjunction withelectronic device 12. Examples of accessories include audio devices suchas audio devices that contain or work with one or more speakers.Speakers in accessory 14 may be provided as an earphone or a headset ormay be provided as a set of stand-alone powered or unpowered speakers(e.g., desktop speakers). Accessory 14 may, if desired, includeaudio-visual (AV) equipment such as a receiver, amplifier, television orother display, etc. Devices such as these may use path 16 to receiveaudio signals from device 12. The audio signals may, for example, beprovided in the form of analog audio signals that need only be amplifiedor passed to speakers to be heard by the user of device 12. An optionalmicrophone in accessory 14 may pass analog microphone signals to device12. Buttons or other user interface devices may be used to gather userinput for device 12. The use of these and other suitable accessories insystem 10 is merely illustrative. In general, any suitable accessoriesmay be used in system 10 if desired.

Electronic device 12 may be a desktop or portable computer, a portableelectronic device such as a handheld electronic device that has wirelesscapabilities, equipment such as a television or audio receiver, or anyother suitable electronic equipment. Electronic device 12 may beprovided in the form of stand-alone equipment (e.g., a handheld devicethat is carried in the pocket of a user) or may be provided as anembedded system. Examples of systems in which device 12 may be embeddedinclude automobiles, boats, airplanes, homes, security systems, mediadistribution systems for commercial and home applications, displayequipment (e.g., computer monitors and televisions), etc.

Device 12 may communicate with network equipment such as equipment 18over path 22. Path 22 may be, for example, a cellular telephone wirelesspath. Equipment 18 may be, for example, a cellular telephone network.Device 12 and network equipment 18 may communicate over path 22 when itis desired to connect device 12 to a cellular telephone network (e.g.,to handle voice telephone calls to transfer data over cellular telephonelinks, etc.).

Device 12 may also communicate with equipment such as computingequipment 20 over path 24. Path 24 may be a wired or wireless path.Computing equipment 20 may be a computer, a set-top box, audio-visualequipment such as a receiver, a disc player or other media player, agame console, a network extender box, or any other suitable equipment.

In a typical scenario, device 12 may be, as an example, a handhelddevice that has media player and cellular telephone capabilities.Accessory 14 may be a headset with a microphone and a user inputinterface such as a button-based interface for gathering user input.Path 16 may be a four or five conductor audio cable that is connected todevices 12 and 14 using 3.5 mm audio jacks and plugs (as an example).Computing equipment 20 may be a computer with which device 12communicates (e.g., to synchronize a list of contacts, media files,etc.).

While paths such as path 24 may be based on commonly available digitalconnectors such as USB or IEEE 1394 connectors, it may be advantageousto use standard audio connectors such as a 3.5 mm audio connector toconnect device 12 to accessory 14. Connectors such as these are in wideuse for handling audio signals. As a result, many users have acollection of headsets and other accessories that use 3.5 mm audioconnectors. The use of audio connectors such as these may therefore behelpful to users who would like to connect their existing audioequipment to device 12. Consider, as an example, a user of a mediaplayer device. Media players are well known devices for playing mediafiles such as audio files and video files that contain an audio track.Many owners of media players own one or more headsets that have audioplugs that are compatible with standard audio jacks. It would thereforebe helpful to users such as these to provide device 12 with such acompatible audio jack, notwithstanding the availability of additionalports such as USB and IEEE 1394 high speed digital data ports forcommunicating with external devices such as computing equipment 20.

Illustrative examples are shown in FIGS. 2 and 3. In the example of FIG.2, device 12 is a portable computer. Portable computer 12 of FIG. 2 hasa display such as display 30 and user input equipment such as touch padand keys 32. As shown in FIG. 2, device 12 may have an audio jack suchas jack 26 for receiving a mating audio plug. Device 12 may also havedigital ports such as serial and parallel digital data ports (i.e., port28).

In the example of FIG. 3, device 12 is shown as having a screen such asscreen 30 and a user input device such as user interface device 32.Device 32 may be, for example, a click wheel, a touch pad, keys,switches, or other suitable buttons, a touch screen, etc. Screen 30 maybe, for example, a touch screen that covers a large fraction of thefront face of device 12. Audio jack 26 may be provided to allow a userto connect a headset or other accessory to device 12. Additionalconnectors such as connector 28 may also be provided. Connector 28 maybe a 30-pin connector, a USB port, etc.

If desired, connectors such as audio connector 26 in FIGS. 2 and 3 maybe the sole input-output connector on a given device 12. Additionalconnectors may also be provided (e.g., one, two, three, or more thanthree additional connectors). Such additional connectors may be suitablefor handling audio, digital signals, etc.

Illustrative audio connectors that may be used to interconnect device 12and accessory 14 are shown in FIG. 4. As shown in FIG. 4, audioconnectors 46 may include audio plugs such as plugs 34 and 36 that matewith corresponding audio jacks such as audio jacks 38 and 40. Connectors46 may be used at any suitable location or locations within path 16(FIG. 1). For example, audio jacks such as jacks 38 and 40 can be formedwithin the housing of device 12, as shown in the examples of FIGS. 2 and3 and plugs such as plugs 34 and 36 can be formed on the end of a cablethat is associated with a headset or other accessory 14. As shown inFIG. 4, cable 70 may be connected to audio plug 34 via strain-reliefplug structure 66 and cable 72 may be connected to audio plug 36 viastrain-relief plug structure 68. Structures such as structures 66 and 68may be formed with an external insulator such as plastic (as anexample).

Audio plug 34 is an example of a four-contact plug. A four-contact plughas four conductive regions that mate with four corresponding conductiveregions in a four-contact jack such as jack 38. As shown in FIG. 4,these regions may include a tip region such as region 48, ring regionssuch as rings 50 and 52, and a sleeve region such as region 54. Theseregions surround the cylindrical surface of plug 34 and are separated byinsulating regions 56. When plug 34 is inserted in mating jack 38, tipregion 48 may make electrical contact with jack tip contact 74, rings 50and 52 may mate with ring regions 76 and 78, and sleeve 54 may makecontact with sleeve terminal 80. In a typical configuration, there arefour wires in cable 70, each of which is electrically connected to arespective contact. Ring 52 may serve as ground. Tip 48 and ring 52 maybe used together to handle a left audio channel (e.g., signals for aleft-hand speaker in a headset). Ring 50 and ring 52 may be used forright channel audio. In accessories that contain microphones, ring 52and sleeve 54 may be used to carry microphone audio signals from theaccessory to electronic device 12. Because this type of wiring scheme iscommonly used in other devices, contacts such as contact 54 and theassociated line in cable 70 (i.e., one of lines 88) are sometimesreferred to as the microphone contact and microphone line, even when nomicrophone is present in accessory 14. Plugs and accessories with thisconfiguration have tip, outer ring, inner ring, and sleeve contacts thatare respectively associated with left audio, right audio, ground, andmicrophone signals. If desired, plugs and jacks with other signalassignment schemes may be used. For example, sleeve 80 may be used forground and ring 52 may be used as a microphone contact, etc.

Plug 36 of FIG. 4 is an example of a three-contact audio connector. Tip60 mates with region 82 in jack 40. Ring 62 on plug 36 mates with ringregion 84 in jack 40. Sleeve region 64 electrically connects to region86 in jack 40 when plug 36 is inserted in jack 40. There is generally nomicrophone line in wires 90, because tip 60 and ring 62 are used forleft and right speaker signals.

As indicated by dashed lines 42, it is physically possible to insert afour-connector plug such as plug 34 into a three-connector jack such asjack 40, although doing so will short ring 52 of plug 34 to sleeve 54 ofplug 34, thereby preventing normal use of microphone contact 54 and theassociated microphone line in lines 88 of cable 70. Similarly, asindicated by dashed lines 44, it is possible to physically insert athree-contact plug such as plug 36 into a four-contact jack such as jack38, although this will short regions 78 and 80 and will therefore notallow these regions to operate independently. If desired, audioconnectors may be used that have more than four contacts or that havefewer than three contacts. For clarity, however, aspects of theinvention will sometimes be described in the context of examples basedon three-contact and four-contact audio connectors.

The FIG. 4 examples are merely illustrative audio connectors that may beused to interconnect device 12 and accessory 14. In general, audioconnectors such as audio connectors 46 may be formed from any suitableplugs (male connectors) and any suitable jacks (female connectors) orany other suitable mating connectors. Moreover, connectors 46 may beplaced at any suitable locations along path 16. With a typicalarrangement, a jack is mounted within device 12 and a mating plug isconnected to accessory 14 by a cable. This is, however, merelyillustrative. A jack may be mounted in accessory 14 and a plug may beconnected to device 12 via a cable. As another example, jacks may beused in both device 12 and accessory 14 and a double-ended cable (i.e.,a cable with male connectors on either end) may be used to connectdevice 12 with accessory 14. Adapters may also be used. For example, anadapter may be plugged into device 12 (e.g., using a digital port). Theadapter, which may be considered to be a type of accessory 14, may beprovided with a jack into which a plug from a headset or other equipmentmay be inserted to complete path 16. In this type of scenario, theadapter may contain circuitry for performing functions that wouldotherwise be performed by buttons and circuitry on the headset.

An illustrative accessory is shown in FIG. 5. Accessory 14 of FIG. 5 isa headset with a microphone. Speakers 92 may be provided in the form ofover-the-ear speakers, ear plugs, or ear buds (as examples).Dual-conductor wires such as wires 94 may be used to connect speakers 92to user interface main unit 96. Unit 96 may include a microphone 98. Insome applications, microphone 98 may not be needed and may therefore beomitted from accessory 14 to lower cost. In other applications, such ascellular telephone application, voice recording applications, etc.,microphone 98 may be used to gather audio signals (e.g., from the soundof a user's voice).

Unit 96 may include user input devices such as user input interface 100.In the FIG. 5 example, unit 96 includes three buttons. If desired, morebuttons, fewer buttons, or non-button user input devices may be includedin accessory 14. Moreover, it is not necessary for these devices to bemounted to the same unit as microphone 98. The FIG. 5 arrangement ismerely illustrative. If desired, unit 96 may be connected within one ofthe branch paths 94, rather than at the junction between path 108 andpaths 94. This may help position a microphone within unit 96 closer tothe mouth of a user, so that voice signals can be captured accurately.An illustrative headset with buttons and a microphone that may belocated in this way and that may be used as an accessory 14 forelectronic device 12 is described in commonly-assignedconcurrently-filed patent application Ser. No. ______ having AttorneyDocket No. P6779US1 and being entitled “Accessory Controller forElectronic Devices” (Wey-Jiun Lin et al.), which is hereby incorporatedby reference herein in its entirety. An example of another multi-buttonheadset on which accessory 14 may be based is described incommonly-assigned concurrently-filed patent application Ser. No. ______having Attorney Docket No. P5841US1 and being entitled “In Cable MicroInput Devices” (Kurt Stiehl et al.), which is hereby incorporated byreference herein in its entirety.

In an illustrative three-button arrangement, a first of the threebuttons such as button 102 may be pressed by a user when it is desiredto advance among tracks being played back by a music application or maybe used to increase a volume setting. A second of the three buttons,such as button 104 may be pressed when it is desired to stop musicplayback, answer an incoming cellular telephone call made to device 12from a remote caller, or when it is desired to make a menu selection. Athird of the three buttons such as button 106 may be selected when it isdesired to move to an earlier track or when it is desired to lower avolume setting. Multiple clicks, click and hold operations, and otheruser input patterns may also be used. The up/down volume,forward/reverse track, and “answer call” examples described inconnection with FIG. 5 are merely illustrative. In general, the actionthat is taken in response to a given command may be adjusted by a systemdesigner through modification of the software in device 12.

As shown in FIG. 5, a cable such as cable 108 may be integrated intoaccessory 14. At its far end, cable 108 may be provided with a connectorsuch as audio connector 110. In the FIG. 5 example, accessory 14 has twospeakers 92 and a microphone (microphone 98). Connector 110 maytherefore be of the four-contact variety. In accessories in whichmicrophone 98 or one of the speakers is omitted, signals can be carriedover a three-contact connector. If desired, connectors with additionalcontacts may also be used (e.g., to carry auxiliary power, to carrycontrol signals, etc.). Audio connectors with optical cores can be usedto carry optical signals in addition to analog electrical signals. Ifdesired, microphone 98 may be connected at a location along one of thewires leading to speakers 92, as this may help position microphone 98adjacent to the mouth of a user.

Accessory 14 may be provided with circuitry that helps convey signalsfrom user input interface 100 to device 12 over path 16. In general, anysuitable communications format may be used to convey signals (e.g.,analog, digital, mixed arrangements based on both analog and digitalformats, optical, electrical, etc.). These signals may be conveyed onany suitable lines in path 16. To avoid the need to provide extraconductive lines in path 16 and to ensure that accessory 14 is ascompatible as possible with standard audio jacks, it may be advantageousto convey signals over existing lines (e.g., speaker, microphone, andground). In particular, it may be advantageous to use the microphone andground lines (e.g., the lines connected to contacts such as sleeve 54and ring contact 52 in audio plug 34 of FIG. 4) to convey signals suchas user input signals and control signals between accessory 14 andelectronic device 12.

With one suitable communications arrangement, buttons such as buttons102, 104, and 106 may be encoded using different resistances. When auser presses a given button, device 12 can measure the resistance ofuser input interface 100 over the microphone and ground lines and canthereby determine which button was pressed. With another suitablearrangement, a button may be provided that shorts the microphone andground wires in cable 108 together when pressed. Electronic device 12can detect this type of momentary short. With yet another suitablearrangement, button presses within interface 100 may be converted toultrasonic tones that are conveyed over the microphone and ground line.Electronic device 12 can detect and process the ultrasonic tones.

If desired, electronic device 12 can support communications using two ormore of these approaches. Different approaches may be used, for example,to support both legacy hardware and new hardware, to support differenttypes of software applications, to support reduced power operation incertain device operating modes, etc.

Ultrasonic tones lie above hearing range for human hearing (generallyconsidered to be about 20,000 Hz). In a typical arrangement, theultrasonic tones might fall within the range of 75 kHz to 300 kHz (as anexample). Ultrasonic tones at frequencies of less than 75 kHz may beused, but may require more accurate circuitry to filter from normalmicrophone audio signals. Ultrasonic tones above 300 kHz may becomesusceptible to noise, because the conductors in many headset cables arenot design to handle high-frequency signals. The cables can be providedwith shielding and other structures that allow high speed signaling tobe supported, or, more typically, lower tone frequencies may be used.

Ultrasonic tones may be formed using any suitable oscillating waveformsuch as a sine wave, saw (triangle) wave, square wave, etc. An advantageof saw and sine waves is that these waveforms contain a narrower rangeof harmonics than, for example, square waves. As a result, ultrasonictones based on sine or saw waves may exhibit relatively narrowbandwidth. This may simplify detection and reduce the likelihood ofaudio interference.

Ultrasonic tones will not be audible to human hearing and thereforerepresent a form of out-of-band transmission. Arrangements that rely onultrasonic tones in this way can avoid undesirable audible pops andclicks that might otherwise be associated with a button arrangement thatmomentarily shorts the microphone line and ground line together upondepression of a button and thereby momentarily disrupts normal operationof the microphone signal path.

In configurations in which the microphone and ground are shortedtogether upon button actuation events, it will generally not be possibleto transmit audio information such as microphone signals while themicrophone and ground line are shorted. An advantage of using devicesthat do not short the microphone and ground lines together such asdevices that use ultrasonic tones to convey button actuation information(and that may therefore omit shorting switches between the microphoneand ground lines) is that this allows audio information such asmicrophone signals to be transmitted in a continuous uninterruptedfashion. Even if a user is currently carrying on a telephoneconversation, the user may press buttons that are ultrasonically encodedwithout interrupting the telephone conversation. Each time a button ispressed, the button press event results in the transmission of acorresponding ultrasonic tone, but does not short the microphone andground lines. The other party to the user's telephone conversation willtherefore be able to hear the user's voice without interruption. Themicrophone and ground lines can be used to convey microphone signals,while the user is able to control the operation of the user's devicewithout concern about disturbing the conversation.

The ability to simultaneously make button presses and to carry onuninterrupted conversation is generally not present in conventionaldevices that rely on momentarily shorting of the microphone line toground. This is because the shorting operation in conventional devicesblocks transmission of microphone signals, whereas the ultrasonic tonesthat are used to represent button press events fall out of the humanhearing range and can therefore be simultaneously transmitted withmicrophone signals without being audible to a user.

Circuitry may be provided within accessory 14 (e.g., within main unit96) to handle operations associated with communicating between accessory14 and device 12. For example, circuitry may be provided in accessory 14to transmit ultrasonic tones and to receive signals from device 12. Ifdesired, this circuitry may be provided in an accessory that takes theform of an adapter.

An illustrative arrangement that is based on an adapter is shown in FIG.6. As shown in FIG. 6, headset 14 may have an audio plug 116 that plugsinto a mating audio jack 114 on adapter 112 (itself a type of accessory14). Plug 116 and jack 114 may be audio connectors such as audioconnectors 46 of FIG. 4. Adapter 112 may include electrical paths thatpass audio signals from device 12 to speakers in headset 14 and thatpass microphone signals from microphone 98 to device 12. Adapter 112 mayalso include the circuitry that handles communications with device 12over path 16 that would otherwise be included within an accessory suchas accessory 14 of FIG. 5. It is therefore not necessary for headset 14in the FIG. 6 arrangement to include this circuitry. In the FIG. 6example, headset 14 includes speakers 92 and microphone 98, but need notinclude any buttons, because buttons 102, 104, and 106 are included onaccessory 112. Accessory 112 may have a cable such as cable 108 with anaudio connector 118 for plugging into a mating audio jack on device 12.Adapter-type arrangements such as the arrangement of FIG. 6 allow a userto add button functionality to an accessory such as a headset that doesnot include buttons. This may be particularly advantageous if a useralready owns several different styles of buttonless headset, yet desiresto use buttons such as buttons 102, 104, and 106 to control electronicdevice 12 remotely. If desired, accessory 112 may be provided with amicrophone.

Electronic device 12 and accessory 14 may communicate over paths such aspath 16 using any suitable techniques. For example, device 12 maypresent one or more direct current (DC) voltages on suitable lines inpath 16 (e.g., across the microphone and ground line pair). These DCvoltages may bias any microphone that is present in accessory 14 and mayserve as control signals. In turn, accessory 14 may communicate withdevice 12 using ultrasonic tones. Accessory 14 may also have resistivelyencoded buttons or other controls. In this type of arrangement, device12 can bias the resistive network associated with the resistivelyencoded buttons and can sense the resulting voltage. Information onbutton activity can also be conveyed from accessory 14 to device 12using a switch that momentarily shorts the microphone and ground linesin path 16 to each other. Shorts in accessory 14 lead to a detectablezero-voltage condition across these lines that can be detected by device12.

Arrangements such as these allow device 12 to discover which type ofaccessory 14 is attached to device 12 and allow user inputs to beconveyed from accessory 14 to device 12 during normal operation. Ifdesired, other communications techniques may be used. For example,device 12 and accessory 14 may communicate using a bidirectionalhigh-speed digital link. The link may be compliant with standardprotocols such as the USB protocol (as an example). Digital data canalso be conveyed using other buses (e.g., an RS-232 bus, aHigh-Definition Multimedia Interface (HDMI) bus, other parallel andserial buses, etc. If desired, device 12 may be provided with anultrasonic transmitter so that device 12 may transmit ultrasonic tonesto a mating ultrasonic receiver in accessory 14. Accessory 14 may beprovided with power supply circuitry that supplies various DC voltagesto device 12 as a form of communication. Resistance coding may be usedin device 12 (e.g., to allow accessory 14 to determine what type ofdevice 12 is in communication with accessory 14). These arrangements,other suitable arrangements, and combinations of such arrangements maybe used to support communications over path 16.

In environments in which both device 12 and accessory 14 are able totransmit information over path 16, handshaking schemes may be used.Handshaking may be used upon device power-up, when an accessory isplugged into device 12, whenever accessory 14 transmits user input todevice 12, or at any other suitable time. Handshakes may take the formof confirmatory signals that indicate that devices are operatingproperly or that echo transmitted data to confirm signal integrity.Bidirectional exchanges of handshake-type information may also be usedto identify equipment and to implement security features. For example,whenever an accessory is connected to device 12, device 12 may query theattached accessory to determine the type of accessory that is in use andto verify that the accessory is authorized (e.g., with an appropriatesecurity code or other identifier).

Support for extensive communications capabilities typically involvesadditional cost and complexity, so a designer of electronic devices suchas device 12 and accessories such as accessory 14 may need to maketradeoffs. For some applications, it may be desirable to foregoextensive bidirectional communications support in the interests ofreducing weight, cost, complexity, and power consumption requirements.For other applications, issues such as security and data integrity maybe more important. In environments such as these, the inclusion of moreextensive communications circuitry in device 12 and accessory 14 may bejustified.

A generalized diagram of an illustrative electronic device 12 andaccessory 14 is shown in FIG. 7. In the FIG. 7 example, device 12 andaccessory 14 are shown as possibly including numerous components forsupporting communications and processing functions. If desired, some ofthese components may be omitted, thereby reducing device cost andcomplexity. The inclusion of these components in the schematic diagramof FIG. 7 is merely illustrative.

Device 12 may be, for example, a computer or handheld electronic devicethat supports cellular telephone and data functions, global positioningsystem capabilities, and local wireless communications capabilities(e.g., IEEE 802.11 and Bluetooth®) and that supports handheld computingdevice functions such as internet browsing, email and calendarfunctions, games, music player functionality, etc. Accessory 14 may be,for example, a headset with or without a microphone, a set ofstand-alone speakers, audio-visual equipment, an adapter (e.g., anadapter such as adapter 112 of FIG. 6), an external controller (e.g., akeypad), or any other suitable device that may be connected to device12. Path 16 may include audio connectors such as connectors 46 of FIG. 4or other suitable connectors.

As shown in FIG. 7, device 12 and accessory 14 may include storage 126and 144. Storage 126 and 144 may include one or more different types ofstorage such as hard disk drive storage, nonvolatile memory (e.g., flashmemory or other electrically-programmable-read-only memory), volatilememory (e.g., static or dynamic random-access-memory), etc.

Processing circuitry 128 and 146 may be used to control the operation ofdevice 12 and accessory 14. Processing circuitry 128 and 146 may bebased on processors such as microprocessors and other suitableintegrated circuits. These circuits may include application-specificintegrated circuits, audio codecs, video codecs, amplifiers,communications interfaces, power management units, power supplycircuits, circuits that control the operation of wireless circuitry,radio-frequency amplifiers, digital signal processors, analog-to-digitalconverters, digital-to-analog converters, or any other suitablecircuitry.

With one suitable arrangement, processing circuitry 128 and 146 andstorage 126 and 144 are used to run software on device 12 and accessory14. The complexity of the applications that are implemented depends onthe needs of the designer of system 10. For example, the software maysupport complex functionality such as internet browsing applications,voice-over-internet-protocol (VOIP) telephone call applications, emailapplications, media playback applications, operating system functions,and less complex functionality such as the functionality involved inencoding button presses as ultrasonic tones. To support communicationsover path 16 and to support communications with external equipment suchas equipment 18 and 20 of FIG. 1, processing circuitry 128 and 146 andstorage 126 and 144 may be used in implementing suitable communicationsprotocols. Communications protocols that may be implemented usingprocessing circuitry 128 and 146 and storage 126 and 144 includeinternet protocols, wireless local area network protocols (e.g., IEEE802.11 protocols—sometimes referred to as Wi-Fi®), protocols for othershort-range wireless communications links such as the Bluetooth®protocol, protocols for handling 3G communications services (e.g., usingwide band code division multiple access techniques), 2G cellulartelephone communications protocols, serial and parallel bus protocols,etc. In a typical arrangement, more complex functions such as wirelessfunctions are implemented exclusively or primarily on device 12 ratherthan accessory 14, but accessory 14 may also be provided with some orall of these capabilities if desired.

Input-output devices 130 and 148 may be used to allow data to besupplied to device 12 and accessory 14 and may be used to allow data tobe provided from device 12 and accessory 14 to external destinations.Input-output devices 130 and 148 can include devices such as non-touchdisplays and touch displays (e.g., based on capacitive touch orresistive touch technologies as examples). Visual information may alsobe displayed using light-emitting diodes and other lights. Input-outputdevices 130 and 148 may include one or more buttons. Buttons andbutton-like devices may include keys, keypads, momentary switches,sliding actuators, rocker switches, click wheels, scrolling controllers,knobs, joysticks, D-pads (direction pads), touch pads, touch sliders,touch buttons, and other suitable user-actuated control interfaces.Input-output devices 130 and 148 may also include microphones, speakers,digital and analog input-output port connectors and associated circuits,cameras, etc. Wireless circuitry in input-output devices 130 and 148 maybe used to receive and/or transmit wireless signals.

As shown schematically in FIG. 7, input-output devices 130 may sometimesbe categorized as including user input-output devices 132 and 150,display and audio devices 134 and 152, and wireless communicationscircuitry 136 and 154. A user may, for example, enter user input bysupplying commands through user input devices 132 and 150. Display andaudio devices 134 and 152 may be used to present visual and sound outputto the user. These categories need not be mutually exclusive. Forexample, a user may supply input using a touch screen that is being usedto supply visual output data.

As indicated in FIG. 7, wireless communications circuitry 136 and 154may include antennas and associated radio-frequency transceivercircuitry. For example, wireless communications circuitry 136 and 154may include communications circuitry such as radio-frequency (RF)transceiver circuitry formed from one or more integrated circuits, poweramplifier circuitry, passive RF components, antennas, and othercircuitry for handling RF wireless signals. Wireless signals can also besent using light (e.g., using infrared communications).

The antenna structures and wireless communications devices of devices 12and accessory 14 may support communications over any suitable wirelesscommunications bands. For example, wireless communications circuitry 136and 154 may be used to cover communications frequency bands such ascellular telephone voice and data bands at 850 MHz, 900 MHz, 1800 MHz,1900 MHz, and 2100 MHz (as examples). Wireless communications circuitry136 and 154 may also be used to handle the Wi-Fi® (IEEE 802.11) bands at2.4 GHz and 5.0 GHz (also sometimes referred to as wireless local areanetwork or WLAN bands), the Bluetooth® band at 2.4 GHz, and the globalpositioning system (GPS) band at 1575 MHz.

Although both device 12 and accessory 14 are depicted as containingwireless communications circuitry in the FIG. 7 example, there aresituations in which it may be desirable to omit such capabilities fromdevice 12 and/or accessory 14. For example, it may be desired to poweraccessory 14 solely with a low-capacity battery or solely with powerreceived through path 16 from device 12. In situations such as these,the use of extensive wireless communications circuitry may result inundesirably large amounts of power consumption. For low-powerapplications and situations in which low cost and weight are of primaryconcern, it may therefore be desirable to limit accessory 14 tolow-power consumption wireless circuitry (e.g., infrared communications)or to omit wireless circuitry from accessory 14. Moreover, not alldevices 12 may require the use of extensive wireless communicationscapabilities. A hybrid cellular telephone and media player device maybenefit from wireless capabilities, but a highly portable media playermay not require wireless capabilities and such capabilities may beomitted to conserve cost and weight if desired.

Transceiver circuitry 120 and 138 may be used to support communicationsbetween electronic device 12 and accessory 14 over path 16. In general,both device 12 and accessory 14 may include transmitters and receivers.For example, device 12 may include a transmitter that produces signalinformation that is received by receiver 142 in accessory 14. Similarly,accessory 14 may have a transmitter 140 that produces data that isreceived by receiver 124 in device 12. If desired, transmitters 122 and140 may include similar circuitry. For example, both transmitter 122 andtransmitter 140 may include ultrasonic tone generation circuitry (as anexample). Receivers 124 and 142 may each have corresponding tonedetection circuitry. Transmitters 122 and 140 may also each have DCpower supply circuitry for creating various bias voltages, digitalcommunications circuitry for transmitting digital data, or othersuitable transmitter circuitry, whereas receivers 124 and 142 may havecorresponding receiver circuitry such as voltage detector circuitry,digital receivers, etc. Symmetric configurations such as these may allowcomparable amounts of information to be passed in both directions overlink 16, which may be useful when accessory 14 needs to presentextensive information to the user through input-output devices 148 orwhen extensive handshaking operations are desired (e.g., to supportadvanced security functionality).

It is not, however, generally necessary for both device 12 and accessory14 to have identical transmitter and receiver circuitry. Device 12 may,for example, be larger than accessory 14 and may have available on-boardpower in the form of a rechargeable battery, whereas accessory 14 may beunpowered (and receiving power only from device 12) or may have only asmall battery (for use alone or in combination with power received fromdevice 12). In situations such as these, it may be desirable to providedevice 12 and accessory 14 with different communications circuitry.

As an example, transmitter 122 in device 12 may include adjustable DCpower supply circuitry. By placing different DC voltages on the lines ofpath 16 at different times, device 12 can communicate relatively modestamounts of data to accessory 14. This data may include, for example,data that instructs accessory 14 to power its microphone (if available)or to respond with an acknowledgement signal. A voltage detector andassociated circuitry in receiver 138 of accessory 14 may process the DCbias voltages that are received from device 12. In this type ofscenario, transmitter 140 in accessory 14 may include an ultrasonic tonegenerator that supplies acknowledgement signals and user input data(e.g., button press data) to device 12. A tone detector in receiver 124may decode the tone signals for device 12.

Applications running on the processing circuitry of device 12 may usethe decoded user input data as control signals. As an example, acellular telephone application may interpret the user input as commandsto answer or hang up a cellular telephone call, a media playbackapplication may interpret the user input as commands to skip a track, topause, play, fast-forward, or rewind a media file, etc. Still otherapplications may interpret user button-press data or other user input ascommands for making menu selection, etc.

Illustrative steps involved in using electronic device 12 and accessory14 are shown in FIG. 8. At step 156, a user may connect accessory 14 todevice 12. For example, a user may insert a male audio connector such asone of the audio plugs of FIG. 4 into a mating female connector indevice 12 such as one of the audio jacks in FIG. 4. (If an adapter suchas adapter 112 of FIG. 6 is being used, the user plugs adapter 112 intodevice 12 and plugs accessory 14 into adapter 112.) The process ofattaching accessory 14 to device 12 involves creating a wired path(e.g., path 16) in which contacts in the audio connector of theaccessory mate with corresponding contacts in the audio connector of thedevice and thereby connect the conductive lines of path 16 betweendevice 12 and accessory 14.

Once device 12 and accessory 14 have been electrically interconnected inthis way, the electronic device and the accessory may interact at step158. In general, the interactions of step 158 may include transmissionand reception by device 12 and accessory 14 of any suitable signals(e.g., using the transceiver circuitry 120 and 138 of FIG. 7). In onesuitable arrangement, device 12 supplies various DC bias voltages toaccessory 14 over the microphone line and the ground line. In responseaccessory may transmit an ultrasonic acknowledgement tone. If desired,information on the identity of the accessory 14 (e.g., its type, serialnumber, part number, associated user identity, or other suitableinformation) may be conveyed to device 12 by encoding information inultrasonic tones. The point in the biasing process at which anultrasonic tone is conveyed to device 12 may also be used as anindicator of accessory identity information or other suitableinformation. If desired, device 12 and accessory 14 may be preventedfrom operating together until suitable handshaking or securityauthentication criteria have been satisfied.

Device 12 may, in response to information received from accessory 14, orin response to the needs of an application running on device 12, makebias voltage adjustments after accessory 14 has been identified orproper operation confirmed. Such bias voltage adjustments may, forexample, be used to place accessory 14 and device 12 in one or moredesired modes of operation. These modes may include, for example, a tonemode in which user input is conveyed using ultrasonic tones and aresistance detection mode in which user input is conveyed using aresistively encoded button actuation arrangement.

Once device 12 has completed all desired start-up operations (e.g.,accessory discovery, confirmation operations, authentication, etc.),processing may proceed to step 160. During the operations of step 160, auser may operate device 12 and accessory 14 in a normal user mode ofoperation. At this time, the user may supply input to accessory 14 usinginput-output devices 148. As an example, the user may press or otherwiseactuate a button or other switch, the user may press an appropriateportion of a touch screen or touch-sensitive button, the user mayactuate a joystick, or may make any other user input. This user inputmay be transmitted to device 12 and received by transceiver circuitry120. At the same time, if accessory 14 has a microphone, sound input maybe gathered and conveyed to device 12 over path 16 (e.g., over themicrophone and ground lines). A corresponding microphone amplifier inprocessing circuitry 128 may be used to receive this audio signal.Device 12 may also supply output to the user. For example, device 12 mayplay audio signals through speakers in accessory 14 using speaker lines(and the associated ground line) in path 16. Other output (e.g., video,status information, etc.) may also be conveyed to the user and presentedusing input-output devices 148.

During the operations of step 160, the mode of operation of device 12and accessory 14 may change. For example, if a user switches betweenusing a telephone application (in which a microphone is required tocapture the user's voice) to a media playback operation (in which themicrophone is not used), device 12 and accessory 14 may switch from atone mode (in which user input is conveyed as ultrasonic tones fromaccessory 14 to device 12) to a resistance detection mode (in whichdevice 12 monitors the resistance of a resistor network associated withbuttons on accessory 14 to determine which buttons are pressed). Theremay be advantages to using one mode over the other. For example, onemode of operation (e.g., the resistance detection mode) may consume lesspower or may be compatible with a wider range of accessories 14. Modeadjustments may be made when different applications are launched ondevice 12, when a given application exercises a different set offeatures, or at any other suitable time. In some situations, differentoperating modes may be invoked when a user removes an accessory of onetype and connects an accessory of a different type.

If desired, each different type of device 12 may be configured tooperate properly with only a particular corresponding type of accessory.More generally, it can be advantageous to allow various devices andaccessories to operate with one another. In environments such as these,the functionality that is available to the user may vary depending onwhich capabilities are available in the device and accessory.

A basic accessory is shown in FIG. 9. In the example of FIG. 9,accessory 14 has two speakers 92. Accessory 14 of FIG. 9 may be, forexample, a stereo headset of a set of accessory speakers. Conductivelines 94 may be used to connect speakers 92 to left and right terminalsL and R and ground terminal G. These terminals may be associated withappropriate contacts in a plug such as plug 36 of FIG. 4. Because theillustrative accessory of FIG. 9 does not contain a microphone orbuttons, the user of this accessory is only able to receive audio and isnot able to supply audio or button press information.

Corresponding circuitry 162 that may be used in device 12 to supplyaudio signals to speakers 92 of accessory 14 of FIG. 9 is shown in FIG.10. As shown in FIG. 10, circuitry 162, which may be part of processingcircuitry 128 of FIG. 7, may have digital-to-analog converter 164 andamplifiers 166 and 168. Digital-to-analog converter circuitry 164 mayreceive digital input from a processor using digital input 170 and maysupply corresponding analog audio signals to terminals L, R, and G usingamplifiers 166 and 168 and lines 172. Terminals L, R, and G may beassociated with contacts in an audio connector as described inconnection with FIG. 4.

Circuitry such as circuitry 162 may be used in device 12 whenever it isdesired to provide speakers in accessory 14 with audio signals. Incomplex devices 12, additional circuitry may be used (e.g., to gathermicrophone signals and user input signals corresponding to buttonactuation events from an appropriate accessory 14). In simpler devices12, some or all of this additional circuitry may be omitted.

FIG. 11 is a circuit diagram of an illustrative configuration foraccessory 14 that includes a microphone. As shown in FIG. 11, lines 94may be used to connect terminals M, G, R, and L to speakers 92,microphone 174, and switch 176. Switch 176 may be associated with auser-actuated button. Line 94A is connected to microphone terminal M andmay therefore sometimes be referred to as a microphone line. Line 94B isconnected to ground terminal G and may be referred to as a ground line.With the arrangement of FIG. 11, audio signals may be driven onto theleft speaker using the L and G terminals and may be driven onto theright speaker using the R and G terminals. Microphone signals (e.g., theuser's voice or other audio input) may be conveyed to terminals M and Gfrom microphone 174 using lines 94A and 94B. When a user actuates switch176, lines 94A and 94B may be momentarily electrically connected to eachother. This creates a low-impedance path from terminal M to terminal Gthat bypasses microphone 174. If microphone 174 is in use during thebutton actuation event, a click or pop may arise on the microphone linedue to current surges associated with the momentary short. The presenceof the momentary short may be detected using circuitry in device 12,which may then take appropriate action.

Illustrative circuitry 178 that may be used in device 12 wheninterfacing with an accessory of the type shown in FIG. 11 is shown inFIG. 12. Circuitry 178 may be, for example, part of processing circuitry128 of FIG. 7. As shown in FIG. 12, circuitry 178 may include a powersupply 180. Power supply 180 may be a fixed or adjustable power supplyand may impose a bias voltage on line 184 via resistor 182 (which mayserves as a microphone signal load resistor). This bias voltage may beplaced across the microphone terminal M and ground terminal G, therebybiasing microphone line 94A relative to ground line 94B in acorresponding accessory such as accessory 14 of FIG. 11. When a usershorts lines 94A and 94B in an accessory such as accessory 14 of FIG.11, the M and G terminals in circuitry 178 will likewise be shortedtogether. The lack of any appreciable voltage drop across terminals Mand G can be detected using comparator 186. Comparator 186 may have afirst input such as input 190 that is connected to microphone terminal Min circuitry 178 via line 184 and may have a second input such as input188 that receives a reference voltage VREF (e.g., 200 mV). Whenever thedifference in voltage between the M and G terminals falls below VREF,comparator 186 may adjust its output voltage on output 192 (e.g., bytaking a logic low signal on output 192 to a logic high signal or viceversa). This change in the output of comparator 186 may be processed bydownstream processing circuitry in device 12 (e.g., to instruct device12 to take an appropriate action in an applicable software application).

Microphone amplifier 194 in circuitry 178 of FIG. 12 may be used toamplify microphone signals in normal operation (i.e., when switch 176 ofFIG. 11 is not closed). These signals may be received over path 16 fromaccessory 14 using the amplified microphone terminal M and groundterminal G. A corresponding amplified microphone audio signal may besupplied to analog-to-digital converter 196 over path 198.Analog-to-digital converter 196 may digitize the analog microphonesignal. A corresponding digitized version of the microphone signal maybe supplied on output path 200 for subsequent processing (e.g., forwireless transmission to a remote location as part of a cellulartelephone call, etc.). Digital-to-analog converter 164 may be used toconvert digital audio signals to analog audio signals that are drivenonto left and right speaker terminals L and R by amplifiers 166 and 168.If desired, the components of circuitry 178 may be integrated onto oneor more integrated circuits. For example, microphone amplifier 194 maybe provided as part of the same integrated circuit as analog-to-digitalconverter 196 (as an example). As another example, digital-to-analogconverter 164 and analog-to-digital converter 196 may be supplied aspart of the same integrated circuit. Other configurations may also beused (e.g., in which all of circuitry 178 is included on a single chip).

A flow chart of illustrative operations involved in processing userinput gathered using a button such as button 176 in an accessory of thetype shown in FIG. 11 is shown in FIG. 13. At step 202, a user mayconnect the headset or other accessory to device 12. At step 204, whencontact is made between the mating terminals of the female and maleportions of the audio connector, electronic device 12 may biasmicrophone line 94A in accessory 14. For example, microphone line 94Amay be raise to a voltage of 2.7 volts above ground line 94B. This biasmay supply microphone 174 with power and may make it possible for device12 to detect shorts between lines 94A and 94B that result from actuationof button 176.

When a user actuates button 176, terminals M and G in device circuitrysuch as circuitry 178 of FIG. 12 are shorted together. When this changeis detected, the state of output 192 is adjusted by comparator 186.Because the output of comparator 186 is reflective of the occurrence ofa button actuation event, processing circuitry in device 12 can concludethat button 176 has been pressed and may take appropriate action.

If desired, more than one user-actuated button may be provided inaccessory 14. To distinguish between actuation events that involvedifferent buttons, each button may generate a different resultingsignal. The different signals may be different digital codes, differentanalog signals, etc. At device 12, the signals that are generated by agiven button actuation event may be processed to determine which buttonwas pressed (and for how long). Device 12 may then take appropriateaction.

With one suitable arrangement, buttons (or other user input interfacedevices) may use a resistive-encoding scheme. With this type ofarrangement, actuation of different buttons results in differentresistance values within an appropriate portion of the circuitry ofaccessory 14. As an example, consider the arrangement of FIG. 14. In theFIG. 14 example, accessory 14 has speakers 92, but no microphone (as anexample). Buttons in accessory 14 control corresponding switches. Forexample, a first button may control switch 176 and second, third, andfourth buttons may control respective switches 210. The buttons may havea mechanical lock-out feature that allows only a single button or othersuitable number of buttons to be pressed simultaneously or device 12 mayanalyze simultaneous button presses based on known rules (e.g., byaccepting only the button that is pressed first, by associatingparticular actions with particular combinations of button presses,etc.). In a typical arrangement, only a single button is pressed at atime.

When a button is actuated, the configuration of the resistor networkformed by resistors 208 changes. As a result, the resistance betweenterminals M and G (or other suitable audio connector terminals inaccessory 14) changes. The resulting resistance between terminals M andG can be measured and acted upon by device 12.

Schemes of the type shown in FIG. 14 in which buttons are associatedwith various resistors are said to use resistance encoding. Withresistively encoded button arrangements, device 12 can determine whichbuttons are actuated by analyzing the resistance across terminals M andG. If, for example, the leftmost switch 210 in FIG. 14 is closed, theleftmost resistor 208 will be switched into place. If the middle switch210 is closed, the leftmost and middle resistors 208 will be switchedinto place. Closing the rightmost switch 210 will switch all three ofthe FIG. 14 resistors into place. Resistors 208 may all have the sameresistance or may have different resistances, provided that theresulting resistor network allows device 12 to discriminate betweendifferent button presses.

In the FIG. 14 example, button 176 is of the “shorting” varietydescribed in connection with FIG. 11. This type of button may beincluded in the resistive network formed by resistors 208 if desired.Device 12 can discriminate between actuation of button 176 and actuationof buttons 210, because only actuation of button 176 will result in ashort circuit between terminals M and G. Button 176 is optional.Moreover, any suitable number of resistively encoded buttons such asbuttons 210 may be provided if desired. The example of FIG. 14 includesthree buttons, but, as indicated by dots 212, more than threeresistively encoded buttons may be included in accessory 14 if desired.Arrangements with fewer resistively encoded buttons may also be used.

When accessory 14 has resistively encoded switches, device 12 may beprovided with circuitry such as circuitry 214 of FIG. 15. When it isdesired to determine which resistively encoded switch has been actuatedby a user, circuitry 214 may use power supply 180 to supply a known biasvoltage across terminals M and G. The bias voltage may, for example, besupplied through resistor 182. The known bias voltage across the M and Gterminals in device 12 results in a known voltage drop between lines 94Aand 94B in FIG. 14. In this type of arrangement, the resistance ofresistor 182 and the resistance of the components between lines 94A and94B form a voltage divider. The voltage drop across terminals M and G incircuitry 214 of FIG. 15 will change depending on the resistanceproduced between lines 94A and 94B by buttons 210 and their associatedresistors.

Voltage detector 216 may monitor the resulting voltage on terminal Mrelative to ground terminal G and may produce corresponding digitaloutput signals on output 218 for processing by processing circuitry ondevice 12. When the voltage drop across the M and G terminals is high,device 12 can conclude that no buttons have been depressed. When thevoltage drop measured by voltage detector 216 is zero or close to zero,device 12 may conclude that switch 176 has been pressed (if such aswitch is used). Intermediate values of voltage can be correlated withparticular switch actuation patterns in resistively encoded switches210.

In the FIG. 14 arrangement, resistors 208 are connected along line 94Aand each switch 210 is connected along this resistive ladder at arespective tap point. This is merely an illustrative example of asuitable resistor network that may be used for resistively encodingswitches in accessory 14. Another illustrative arrangement is shown inFIG. 16. In the FIG. 16 example, each resistively encoded switch 210 hasa respective series-connected resistor 208. The resistance values ofresistors 208 in arrangements of the type shown in FIG. 16 arepreferably each different, allowing discrimination between switches. Ifthe user presses the first switch, the resistance between lines 94A and94B will be resistance R1, if the user presses the second switch, theresistance will be equal to R2, and if the user presses the thirdswitch, the resistance will be R3. An optional shorting switch such asswitch 176 may be connected in parallel with resistively encodedswitches 210 if desired. The resistance value resulting from useractuation of desired switches 210 in accessory 14 of FIG. 16 may bemeasured using any suitable resistance measuring circuitry such as thebiasing power supply and voltage detector circuits of FIG. 15.

A flow chart of illustrative steps involved in using circuitry of thetype shown in FIG. 15 to determine which of multiple resistively encodedswitches in an accessory such as accessory 14 of FIG. 14 or accessory 14of FIG. 16 has been pressed is shown in FIG. 17. At step 220, theresistive network associated with the buttons in accessory 14 may bebiased using an appropriate bias voltage. The bias voltage may, forexample, be generated by power supply 180 in device 12, as described inconnection with FIG. 15.

When a user presses a button in the user input interface portion ofaccessory 14, the resistance bridging a given pair of lines in path 16such as the microphone and ground lines is altered. In circuits such ascircuit 214 of FIG. 15, the bridging resistance between lines 94A and94B in the accessory forms a voltage divider in combination with theresistance of resistor 182. The fraction of the bias voltage supplied bypower supply 180 that falls across terminals M and G in circuit 214 istherefore determined according to Ohm's law and can be measured usingvoltage detector 216 (step 222). A corresponding digital signal thatidentifies which button was pressed may be supplied on output line 218(step 224). Simultaneous button presses can result in differentdetectable resistances (e.g., intermediate resistance values). Device 12may respond accordingly (e.g., by taking an appropriate action inresponse to the set of buttons that is pressed, by ignoring multiplesimultaneous button presses, etc.).

The embodiments of accessory 14 illustrated in FIGS. 9, 11, 14, and 16are merely illustrative. For example, features of these differentaccessory arrangements may be combined in other topologies if desired. Acircuit diagram of a generalized accessory 14 that may be used in system10 is shown in FIG. 18. In the example of FIG. 18, accessory 14 has beenprovided with a four-contact audio connector such as jack 34 of FIG. 4,having terminals M, G, L, and R. This is, however, merely illustrative.Accessory 14 may be provided with any suitable connector.

As shown in FIG. 18, accessory 14 may have speakers 92. There may, ingeneral, be no speakers 92, one speaker 92, two speakers 92, or anyother suitable number of speakers in a given accessory. Accessories suchas headsets typically include two speakers, so accessory 14 is sometimesdescribed herein as including two speakers as an example.

Accessory 14 may also have circuitry 226. Circuitry 226 may include oneor more optional microphones such as microphone 230 or other audiotransducer equipment. Microphone 230 may be implemented using anysuitable powered or unpowered microphone technology. For example,microphone 230 may be an electret microphone or a microphone formedusing microelectromechanical systems (MEMS) technology. Microphone 230may also be based on other suitable arrangements (e.g., dynamicmicrophones, condenser microphones, piezoelectric microphones, etc.).

User input interface 232 may be used to gather input from a user. In atypical arrangement, user input interface 232 may include buttons. Thisis, however, merely illustrative. User input interface 232 may include atouch screen, a touch pad, a touch-sensitive button, buttons that makeup a portion of a keypad, a joystick, a camera, a proximity sensor, atemperature sensor, an accelerometer, an ambient light sensor, or anyother suitable device for gathering input (e.g., input gathered from auser that is associated with a user interaction with accessory 14).

Control circuitry 228 may be used in processing the user input that hasbeen gathered and may be used in transmitting the user input to device12 over path 16. If, as an example, user input interface 232 includes atouch screen sensor, control circuitry 228 may be used to determine thelocation on the sensor that has been touched by a user. Controlcircuitry 228 may then transmit corresponding information to device 12that indicates the nature of the user's input. As another example, userinput interface 232 may include an array of buttons. When a user pressesa given button, control circuitry 228 may be used to determine whichbutton has been pressed. Control circuitry 228 may communicate thisinformation to device 12, so that device 12 may take appropriateactions.

With one suitable arrangement, control circuitry 228 may includeultrasonic tone generator circuitry that may be used to transmit userinput information to device 12 in the form of ultrasonic tones. This is,however, merely illustrative. Any suitable format may be used fortransmitting information on user input to device 12. Moreover, circuitry226 may, if desired, include circuits of the types described inconnection with FIGS. 11, 14, and 16 in which button activity isconveyed to device 12 by momentarily shorting the microphone and groundlines or by using resistively encoded buttons (as examples). Inaccessories that contain multiple different types of buttonconfigurations such as these, device 12 and accessory 14 may switchbetween different modes of operation depending, for example, on whichapplications or application features are being exercised by device 12 ata given point in time. Different modes of operation may also beapplicable when particular accessories or particular devices are used.For example, in one mode of operation, an electronic device may monitorthe microphone and ground lines in accessory 14 directly to attempt todetect events corresponding to actuation of button 176 or buttons 210,whereas in another mode of operation, the electronic device may use aninternal tone detector to determine whether the accessory is attemptingto transmit user input in the form of ultrasonic tones.

If desired, the buttons or other user interface used in accessory 14 mayavoid the use of buttons that momentarily short the microphone andground lines together. Instead, buttons may, for example, be used tocontrol an ultrasonic tone generator that sends button press informationto an electronic device over the microphone and ground lines in the formof ultrasonic pulses. With this type of scheme, button press events willnot momentarily short the microphone and ground lines together, so pops,clicks, and dead time that might be associated with switches of the typethat short the microphone and ground lines together may be avoided. Thisallows continuous uninterrupted use of the microphone and ground lines(e.g., for carrying on a telephone call while button presses are beingmade). The use of ultrasonic tones may also help avoid interference withtelephone calls, because ultrasonic tones on the microphone line willfall outside the range of human hearing and will therefore not beaudible to users. Multiple buttons can be represented by using more thanone ultrasonic tone. User interface 232 may therefore contain onebutton, two buttons, three buttons, or more than three buttons.

FIG. 19 shows an illustrative arrangement for an accessory such asaccessory 14 showing how circuitry 228 may include impedance detector236 and associated control circuit 238. In this type of arrangement,user input interface 232 may include any suitable resistively encodedcomponents. As shown in FIG. 19, for example, user input interface 232may include an array of resistively encoded buttons 210. Using theillustrative resistive network topology of FIG. 19, each of resistors208 may have a different resistance value. Impedance detector 236 may beconnected to buttons 210 and the resistor network formed by resistors208. When a user actuates a given one of switches 210, impedancedetector 236 may detect the resulting resistance (i.e., R1, R2, R3, orR4 in this example) between impedance detector 236 and line 234 (e.g.,the ground line or the microphone line as examples). Impedance detector236 may then inform control circuit 238 of the identity of the switchthat has been actuated by the user. Control circuit 238 may transmitthis information to device 12 (e.g., using transmitter 140 of FIG. 7).If a user presses more than one button simultaneously, the resultingresistance detected by impedance detector 236 may be an intermediateresistance value such as R1*R2/(R1+R2) if the “R1” and “R2” buttons arepressed. Device 12 may respond to simultaneous button presses such asthese by taking an appropriate action in response to the particular setof buttons that is pressed, by ignoring multiple simultaneous buttonpresses, etc.

In arrangements in which accessory 14 includes control circuitry such ascontrol circuit 238, it is not necessary to use resistance encoding forbuttons 210. An arrangement in which control circuitry 228 has beenimplemented without the resistors 208 of FIG. 19 is shown in FIG. 20. Inarrangements of the type shown in FIG. 20, each switch 210 has twoterminals. Each terminal 240 is connected to control circuit 228 andeach terminal 242 is connected to a suitable circuit node (e.g., line234, which may be, for example, a line that has been biased to aparticular voltage such as a microphone line or ground line). When oneof switches 210 is closed, control circuit 228 can detect which of theterminals 240 has been electrically connected to line 234. In response,control circuit 228 can transmit information to device 12 indicative ofwhich switch has been selected (e.g., using a tone generator or othertransmitter circuitry such as transmitter 140 of FIG. 7). If multiplebuttons are pressed simultaneously, device 12 may take an appropriateaction such as a particular action associated with the combination ofbuttons that have been pressed. Device 12 may also be configured toignore simultaneous button press events.

Illustrative circuitry 244 that may be used in device 12 to interfacewith an accessory that contains a tone generator is shown in FIG. 21.There may be one or more circuits such as circuitry 244 in a givenelectronic device. For example, a laptop with two such circuits may beprovided to allow two users to listen to media, each having their ownseparate volume control.

As shown in FIG. 21, circuitry 244 may include a power supply 180 forbiasing microphone line M through resistor 182 in relation to groundline G. Power supply 180 may be an adjustable voltage supply that device12 uses to bias the microphone line in accessory 14 to one or moredifferent levels. Accessory 14 may, if desired, include circuitry thatis responsive to the different bias voltages (e.g., to place accessory14 into different modes, to direct accessory 14 to send anacknowledgement signal, or to cause accessory to take other suitableactions in response to the received bias from power supply 180).

Tone detector 246 may be coupled to microphone terminal M, as shown inFIG. 21. When accessory 14 transmits ultrasonic tones over path 16, tonedetector 246 may receive those tones on input 248. After processing(e.g., to identify the nature of the incoming tone signal), tonedetector 250 may generate a suitable output on output 250. Output 250may, for example, be used to provide digital signals to downstreamprocessing circuitry so that device 12 can identify which buttons havebeen pressed and can identify what other tone-based information has beenreceived from accessory 14.

Illustrative steps involved in using circuitry such as circuitry 244 ofFIG. 21 in device 12 to communicate with accessory 14 (e.g., anaccessory of the type shown in FIG. 18) are shown in FIG. 22.

At step 252, a user may supply input to accessory 14 using user inputinterface 232. The user may, for example, actuate a switch or other userinterface device to supply accessory 14 with user input.

Circuitry 228 in accessory 14 may process the user input (step 254). Forexample, circuitry 228 may use an impedance detector or other suitablecircuit to identify which button was pressed in a resistively encodedbutton array (as an example).

At step 256, a tone generator or other suitable control circuitry 228may be used to transmit the user input to device 12 over path 16.

At step 258, electronic device 12 may use tone detector 246 to receivethe transmitted tone information. This information may be processed toidentify the user input. For example, incoming tones may be processed torecover user button press data or other user input that is indicative ofa user's desire to control device 12. In response, device 12 may takeappropriate action (step 260). For example, if the user is playing backa media file with device 12 and device 12 receives a user inputindicative of user actuation of stop button 104 (FIG. 5), device 12 canstop the playback of the media file.

The diagram of FIG. 23 indicates how various different electronicdevices 12 can operate in conjunction with various different accessories14. In the FIG. 23 example, there are three electronic devices.

Electronic device 12A may have circuitry such as circuitry 162 of FIG.10 to drive speakers such as the speakers described in connection withaccessory 14 of FIG. 9, but does not include circuitry for handlingmicrophone signals or button presses.

Electronic device 12B may have circuitry such as circuitry 178 of FIG.12 for detecting momentary shorts between a microphone terminal and aground terminal, as described in connection with accessory 14 of FIG.11, but does not have circuitry for processing ultrasonic tones.

Electronic device 12C may have circuitry such as circuitry 244 of FIG.21 to detect tones and, if desired, may have additional circuitry suchas voltage detector 216 of FIG. 15 for detecting resistances associatedwith resistively encoded buttons and circuitry such as comparator 186 ofFIG. 12 for detecting momentary shorts between a microphone and groundline.

Accessories such as accessories 14A, 14B, 14C, and 14D may be pluggedinto devices such as devices 12A, 12B, and 12C. The functionality of theresulting combined system (i.e., a given one of the electronic devicesand a given one of the accessories) depends on which system isconsidered.

Consider, as an example, a scenario in which headset 14A is plugged intodevice 12C. Headset 14A does not have buttons or a microphone and mayhave the functionality of accessory 14 of FIG. 9. When connected todevice 12C, device 12C will not be able to receive or process incomingtones and will not be able to detect electrical shorts. Nevertheless,device 12C will be able to drive audio onto the speakers of accessory14A, through audio connectors 46.

As another example, consider accessory 14B. Accessory 14B may be, forexample, a headset such as headset 14 of FIG. 9 with a microphone of thetype shown in FIG. 11. When connected to device 12C, the microphone inaccessory 14B can supply audio signals that are processed by acorresponding microphone amplifier in device 12C, but because no buttonsare available on accessory 14B, device 12C will not, in this scenario,be able to process or respond to button presses.

Accessory 14C may be, for example, a one-button accessory such asaccessory 14 of FIG. 11. Device 12C may have a comparator such ascomparator 186 that is able to detect when button 176 of accessory 14Cis depressed. Audio may be driven onto the speakers of accessory 14C andmicrophone input from microphone 174 may be processed by microphoneamplifier 194 of FIG. 12.

The remaining scenarios illustrated in FIG. 23 involve accessory 14D.Accessory 14D may be, for example, an accessory of the type described inconnection with FIG. 18. As described in connection with FIG. 18,accessory 14D may have user input interface 232. User input interface232 may include speakers 92, a button such as button 176 that bridgesthe microphone and ground lines in accessory 14D, resistively encodedbuttons, a microphone, and an ultrasonic tone generator.

When connected to a relatively simple device such as audio-out-onlyelectronic device 12A, the speakers in accessory 14D may be used, butthe buttons and microphone will be unavailable.

When connected to device 12B, the microphone in accessory 14D may beused and button presses made using button 176 may be processed. Ifdevice 12B has voltage detector circuitry such as voltage detector 216of FIG. 15, device 12B may be able to directly detect actuation ofvarious resistively encoded buttons. If device 12B does not have voltagedetector circuitry, but only has tone detection circuitry, device 12Bwill not be able to directly detect actuation of resistively encodedbuttons but can detect ultrasonic tones (i.e., ultrasonic tonesgenerated in response to user input).

When an accessory such as accessory 14D is connected to an electronicdevice such as electronic device 12C, both the device and accessory areable to fully exercise a variety of functions. In particular, becausedevice 12C has audio driver circuitry and microphone amplifiercircuitry, device 12C will be able to drive audio signals onto speakersin accessory 14D and will be able to receive incoming microphonesignals. Momentary shorts between the microphone line and ground linethat result from actuation of buttons such as button 176 (FIG. 11) inaccessory 14D may be detected by device 12C using a comparator such ascomparator 186 of FIG. 12 (which may be part of a voltage detectioncircuit such as voltage detector 216 of FIG. 15). Actuation ofresistively encoded buttons may be detected by directly detectingresistance changes between the microphone and ground lines in accessory14D (e.g., using a voltage detector such as voltage detector 216 of FIG.15) or may be detected by receiving and processing ultrasonic tones thataccessory 14D transmits to device 12C in response to button actuationevents.

If desired, the microphone may be omitted from accessory 14D. When anaccessory of this type is connected to a device such as audio-out-onlyelectronic device 12A, the speakers in accessory 14D may be used, butthe buttons will be unavailable. There is no microphone present, so nomicrophone is used.

When an accessory such as a microphoneless accessory 14D is connected todevice 12B, microphone functions associated with device 12B will not beused. However, button presses made using a button such as button 176 ina microphoneless accessory such as accessory 14D may be processed.Moreover, if voltage detector circuitry such as voltage detector 216 ofFIG. 15 is used in device 12B, device 12B may be able to directly detectactuation of various resistively encoded buttons on the microphonelessaccessory. If device 12B does not have voltage detector circuitry, butonly has tone detection circuitry, device 12B will not be able todirectly detect actuation of resistively encoded buttons in amicrophoneless accessory, but can detect ultrasonic tones such asultrasonic tones generated in response to user input.

When an accessory such as accessory 14D that does not have a microphoneis connected to an electronic device such as electronic device 12C,device 12C will be able to drive audio signals onto speakers inaccessory 14D, but will be unable to receive incoming microphonesignals. Momentary shorts between a “microphone” line and a ground linethat result from actuation of buttons such as button 176 (FIG. 11) in anaccessory 14D without a microphone may be detected by device 12C using acomparator such as comparator 186 of FIG. 12. As in scenarios in whichaccessory 14D contains a microphone, when accessory 14D does not includea microphone, actuation of resistively encoded buttons in accessory 14Dmay be detected by directly detecting resistance changes between themicrophone and ground lines in accessory 14D using a voltage detectorsuch as voltage detector 216 of FIG. 15 or may be detected by receivingand processing ultrasonic tones that accessory 14D transmits to device12C in response to button actuation events.

As these various scenarios illustrate, the use of standard audioconnectors such as connectors 46 of FIG. 4 may allow a variety ofdifferent types of accessories to be connected to different electronicdevices. When a device is connected to an accessory that supports fewerfeatures that the device supports, certain features may not be availableto the user. Similarly, when an accessory is connected to a device thatsupports fewer features than the accessory supports, all accessoryfeatures may not be available to the user. When, however, devices andaccessories have comparable feature support, the functions of thedevices and accessories may be more fully utilized. An advantage of thistype of arrangement is that devices such as device 12C that havenumerous features may be used with a wide variety of accessories, evenif those accessories do not fully support the features of device 12C. Ina similar fashion, an accessory such as accessory 14D that supportsnumerous features may be used with a wide variety of electronic devices,even if those electronic devices do not fully support the features ofaccessory 14D.

FIG. 24 is a circuit diagram of illustrative circuitry that may be usedin an electronic device 12 that supports features such as tone modedetection. As shown in FIG. 24, circuitry 262 may include power supplycircuitry 180. Power supply 180 may be a DC power supply that usesswitching circuit 264 to supply an adjustable DC power supply voltage onits output. Filter 266 may use resistor 182 to supply the output voltagefrom power supply 180 to node M, where it may be used as a microphonecontact bias voltage for biasing microphone line 94A in accessory 14.With one suitable arrangement, power supply 180 may be adjusted toprovide voltages of 0 volts (ground), 2.0 volts, or 2.7 volts onterminal M or may be place in an open circuit configuration in whichterminal M floats. A raw power supply voltage AVDD of more than 2.7volts or other suitable voltage level may be supplied to the AVDDterminal of FIG. 24. If desired, power supplies with more adjustableoutput voltage levels or fewer adjustable output voltage levels may beused.

Incoming microphone signals from accessory 14 may be amplified usingmicrophone amplifier 194. As shown in FIG. 24, microphone amplifier 194may, for example, be implemented as part of a larger integrated circuitsuch as an audio codec. Resistor 268, which may be, for example, a 10kilo-ohm resistor, may be used in optimizing current protection incircuitry 262. Filter 266, and, in particular, the capacitor in filter266, may be used to remove high frequency noise from microphone terminalM. Resistor 182 may form a load for the microphone circuit when themicrophone of accessory 14 is in use.

Voltage detection circuitry 216 may be used to measure the voltageacross terminals M and G. Audio driver circuitry 166 and 168 may be usedto drive audio signal onto the speakers in accessory 14.

An electromagnetic interference (EMI) filter such a filter 270 may beused to help make circuitry 262 immune to the undesired effects ofelectromagnetic interference.

Tone detector 246 may receive ultrasonic tones from microphone line Mand may provide corresponding digital output on output line 250 thatindicates what type of tones have been received. Control circuitry 274may help to process the tone signal data from line 250.

Control circuitry 274 may include a level shifter such as level shifter276 that serves as an interface between the relatively higher voltagesthat may be used in circuitry 262 and the relatively lower voltages thatmay be used elsewhere in device 12. Communications circuitry in controlcircuitry 274 such as I²C communications circuitry 272 may be used tohelp circuitry 274 communicate with other circuitry on device 12.Circuitry 272 may be used to send and receive digital data over bus 278,which may be, for example, a two-wire I²C bus. Circuitry 274 may have anenable input 280 that receives an enable signal EN. The enable signal ENmay be deasserted when, for example, an application that is runningwithin device 12 desires to disable accessory functions to save power.Interrupt line 282 may be asserted when control circuitry 274 generatesan interrupt signal INT. Processing circuitry such as processingcircuitry 128 of FIG. 7 may periodically examine the state of interruptline 282. When the interrupt is asserted, processing circuitry 128 mayexamine the states of registers within control circuitry 274 todetermine what type of activity in circuitry 262 has resulted in theassertion of the interrupt. This activity might be, for example,detection of an incoming ultrasonic tone, etc.

Illustrative power supply circuitry 180 that may be used in circuitry262 is shown in FIG. 25. As shown in FIG. 25, power supply circuit 180may have fixed power supply 286 and fixed power supply 288. Switch SW1may be closed when it is desired to route the output voltage from supply286 to output node M. Switch SW2 may be closed when it is desired toroute the output voltage from supply 288 to output M. Driver 290 andfeedback path 296 may be used to regulate the output voltage V_(LD0) onnode 298. The voltage on the “+” input of device 290 serves as anadjustable reference voltage. In the example of FIG. 25, V_(LD0) will be2.7 volts when SW1 is closed and SW2 is open and will be 2.0 volts whenSW1 is open and SW2 is closed. Switch SW3 may be closed and switch SW4may be opened when it is desired to route the selected output V_(LD0) tomicrophone node M. When it is desired to ground terminal M, switch SW4may be closed and switch SW3 may be opened. Terminal M may be placed ina floating condition in which terminal M is disconnected from the groundand power supply output by opening both switch SW3 and switch SW4.

Illustrative voltage detection circuitry 216 that may be used incircuitry 262 of FIG. 24 is shown in FIG. 26. Comparator 186 may receivethe voltage on the M terminal on input 190 and may receive a referencevoltage VREF (e.g., 0.2 volts or other suitable value close to 0 volts)on input 188. Comparator 186 may compare the voltage levels on inputs188 and 190 and may assert a corresponding output signal on line 192whenever the voltage on microphone line M falls below VREF, indicatingthat a user has depressed a shorting button such as button 176 (e.g., inFIG. 14).

Comparator circuits C1, C2, C3, and C4 may be used to decode resistivelyencoded button presses when device 12 and accessory 14 are operated in aresistance detection mode. Each comparator may receive a differentreference voltage. These reference voltages may be obtained by dividingvoltage V_(LD0) using a voltage divider (e.g., a voltage divider formedfrom a resistor tree). The four outputs of comparators C1, C2, C3, andC4 collectively form a four-bit digital code that is indicative of theresistance in accessory 14 between microphone line 92A and ground line92B. When, for example, a first button is pressed, only the output of C1may be asserted (e.g., taken to a logic high value), whereas the outputsof C2, C3, and C4 remain low. When, however, a second button is pressedand the resistance between line 92A and 92B changes, the voltage onmicrophone line M will change in response. This may, as an example,cause the outputs of C1, C2, and C3 to go high, while output C4 remainslow. The number of voltage detection comparators such as comparators C1,C2, C3, and C4 that are provided in voltage detection circuitry 216 maybe scaled to accommodate a desired number of resistively encoded buttonsin accessory 14. When there are numerous buttons in accessory 14, thereshould also be numerous comparators in circuit 216. When there arerelatively few buttons in accessory 14, fewer comparators are needed incircuit 216 to discriminate between different button actuation events.

Comparator 312 may receive the microphone line voltage from terminal Mon input 314 and an adjustable reference voltage VR on input 316. Themagnitude of voltage VR may be controlled by controlling the digitalcontrol signals on control lines 306. These control signals may besupplied to switch 300 by control circuitry 274. The inputs to switch300 may be obtained from a voltage divider such a voltage divider 302.Each node of the resistor tree in voltage divider 302 establishes aseparate reference voltage derived from voltage V_(LD0) on node 298. Inresponse to the control signals received on lines 306, switch 300 routesa selected one of these voltages to output 308 for use as the referencevoltage VR on input 316. Comparator 312 compares the microphone voltageon terminal M to the selected value of the reference voltage andproduces a corresponding output 310 that is indicative of whether themicrophone line M is at a higher or lower voltage than the selectedreference voltage. By adjusting switch 300, control circuitry 274 (FIG.24) can accurately measure the magnitude of the voltage on microphoneline M, thereby obtaining information from accessory 14 on the state ofthe microphone in accessory 14. In the example of FIG. 26, switch 300supports 16 different inputs. If desired, finer control may be providedby using a switch with a larger number of inputs. Switches with fewerinputs may also be used if desired.

As indicated schematically by registers R in control circuitry 274 ofFIG. 24, one way in which circuitry 262 may interface with otherprocessing circuitry on device 12 is through the periodic adjustment ofregister values. When, for example, a particular ultrasonic tone isdetected, control circuitry 274 may adjust the contents of acorresponding register in control circuitry 274 and may, if desired,assert the interrupt line 282 to inform processing circuitry on device12 of the need to inspect the new contents of registers R. Any suitablenumber of registers may be used in control circuitry 274 (e.g., one,two, more than two, tens of registers, more than tens of registers,etc.).

Illustrative registers that may be used in registers R of controlcircuitry 274 are shown in FIG. 27. As indicated by the text in theregister boxes of FIG. 27, a variety of status conditions may berepresented by the state of register bits. A TX ACK bit may be set high,for example, when it is desired to set a timer for enabling detection ofan incoming ultrasonic acknowledgement tone (e.g., a tone of aparticular length such as 6 ms). The “short detect only mode” bit may beset high to place device 12 in a low power standby mode of operation(e.g., a mode in which only detector 186 is being used and in which onlybutton presses from shorting buttons such as button 176 of FIG. 11 arerecognized). The “resistor button detect enable” bit may be set highwhen it is desired to use the resistance decoding functions ofcomparators C1, C2, C3, and C4 of FIG. 26 to support direct detection ofuser actuation of resistively encoded buttons (e.g., by analyzing theresistance bridging lines 94A and 94B in accessory 14). The V_(LD0)CTRL0 and V_(LD0) CTRL1 bits may be used to control the magnitude ofV_(LD0) by controlling the states of switches SW1, SW2, SW3, and SW4 ofcircuit 180, as described in connection with FIG. 25. The MIC DETECTbits may represent the values of the control signals applied to the fourinput lines 306 of switch 300 in voltage detector 26 of FIG. 26. The“mic detect true” bit may be set high when control circuitry 274 hasdetected the presence of a microphone in accessory 14 during an initialaccessory discovery process.

An illustrative accessory 14 that may be used to support tone modeoperations and resistance detection mode operations in conjunction withcircuitry 262 of FIG. 24 is shown in FIG. 28. As shown in FIG. 28,accessory 14 may have speakers 92 that are driven by audio outputcircuits such as audio drivers 166 and 168. Buttons may be associatedwith switches S0, S1, S2, S3, and S4. Switch S0 may be used tomomentarily short microphone line M to ground line G and may be usedwhen device 12 is in “short detect only mode” or when a device that onlysupports short detect button decoding operations is used. If desired,switch S0 may be omitted. In configurations in which switch S0 isomitted, button press events (e.g., events in which switch S0 is closedto short the M and G terminals together) are avoided, so that audiosignal transmission between accessory 14 is not interrupted by buttonactuation activity.

Switches S1, S2, S3, and S4 may be resistively encoded using resistors208. The resistive network made up of resistors 208 may be configuredusing any suitable topology, as described in connection with FIGS. 14and 16. The arrangement of FIG. 28 is merely illustrative. Impedancedetector 236 may be used to detect which of switches S1, S2, S3, and S4has been actuated. In resistance detection mode, device 12 may measurethe voltage drop between microphone line M and ground line G, therebydirectly measuring the resistance of the switches. This allows device 12to determine which of switches S1, S2, S3, and S4 has been actuatedwithout using impedance detector 236. In tone mode, impedance detector236 may provide information on which switch has been actuated toadjustable tone generator 318, which, in turn, may transmit appropriatetones to device 12 for detection by tone detector 246 (FIG. 24). Thetones may be transmitted over the microphone and ground lines. The tonesmay be ultrasonic tones that fall out of the range of human hearing andare therefore not disruptive to user activities such as telephone callactivities.

Voltage detector and latch circuitry 320 may respond to various biasvoltages that are applied to microphone line M by device 12. This allowsdevice 12 to control the operation of accessory 14 via path 16. The biasvoltages may be generated by power supply circuitry 180 (FIG. 25) inresponse to control signals from control circuitry 274 (FIG. 24). A biasvoltage on the microphone line may help to power a microphone inaccessory 14. Time-dependent changes in the bias voltage may be used asa way to control accessory 14 and may therefore be considered to form atype of data transfer between device 12 and accessory 14. At the sametime that a bias voltage is being supplied to accessory 14 by device 12using the microphone and ground lines, device 12 may be monitoringmicrophone signals on the microphone and ground lines that result fromcapturing the user's voice or other sound at accessory 14.

Shunt regulator 338 may be used with resistor 328 to regulate thevoltage on node N1. Shunt regulator 338 may operate as a Zener diode,pinning the voltage on node N1 at a desired value over a wide range ofoperating currents. This regulated voltage may be used to powermicrophone 336 through switch SWA when switches SWA and SWC are closed.As indicated by paths 319, shunt regulator 338 may be used to poweradjustable tone generator 318 and impedance detector 236. This preventsnoise in the form of fluctuating currents in adjustable tone generator318 and impedance detector 236 from being added onto microphone line Mthrough resistor 328 and thereby prevents audible noise from being addedto the microphone signal. Resistor 334 sets the magnitude (gain) of themicrophone signal that is coupled onto node M from microphone 336. Inthe arrangement shown in FIG. 28, microphone 336 is being implementedusing a MEMS module. Capacitor 332 is a DC blocking capacitor thatallows alternating current (AC) signals from microphone 336 to pass tomicrophone terminal M, while preventing the DC bias voltage on node Mfrom adversely affecting the bias of amplifier AM in the MEMS module ofmicrophone 336. The MEMS module may include a microphone unit and avoltage multiplier that work in conjunction with amplifier AM to providemicrophone output signals in response to received sound from a user. Ifdesired, other types of microphones may be used such as electretmicrophones (see, e.g., the arrangement of FIG. 30).

As shown in FIG. 28, circuitry 320 may include a comparator 322. Whenthe voltage on line M exceeds a reference voltage (e.g., a referencevoltage obtained from a bandgap voltage reference in accessory 14), theoutput of comparator 322 goes high and sets the output of latch 324high. The output of latch 324 may be conveyed to the control input ofswitch SWB over control line 340. An inverted version of the latchoutput may be conveyed to the control input of switch SWC via controlline 326 and may be conveyed to the control input of switch SWA viacontrol line 330. When it is desired to operate in a resistancedetection mode, switch SWB may be closed, thereby connecting the networkof resistors 208 and switches 210 between terminals M and G. In thissituation, switches SWA and SWC may be open to disable microphone 336.When it is desired to operate in a tone detection mode, switch SWB maybe open and switches SWA and SWC may be closed, thereby disconnectingthe resistively encoded switches from terminals M and G and biasingmicrophone 336 for operation.

In FIG. 30, an illustrative accessory circuit that is based on anelectret microphone rather than a MEMS microphone is shown.

FIG. 31 shows another illustrative arrangement that may be used for thecircuitry of accessory 14. In the circuitry of FIG. 31, resistor RC andcapacitor CC may serve as a tone coupling circuit. This tone couplingcircuit helps properly attenuate tone signals transmitted from tonegenerator 318 to node M. The tone coupling circuit also serves as a highpass filter that allows ultrasonic tones from tone generator 318 to bemerged onto microphone line M, which also carries regular audio signals(e.g., signals from roughly 20 Hz to 20 kHz in frequency) frommicrophone 336. Resistor RB sets the DC bias for microphone line M.Resistor RG and capacitor CG set the AC gain for amplifier AM inmicrophone module 336 (e.g., a MEMS module). Amplifier AM may operate inconstant current mode.

Voltage detector and latch 320 may activate at a suitable thresholdvoltage. When, for example, the voltage on microphone line M is 2.7volts (i.e., greater than a threshold of 2.3 volts), voltage detectorand latch 320 may generate control signals that turn on switches SBW1and SWB2 and that turn off switch SWA. When the voltage on microphoneline M falls below this level, switches SWB1 and SWB2 may be turned offand switch SWA may be turned on. When switches SWB1 and SWB2 are turnedoff in this way, transistor T1 is turned off. This lets node NF floatand turns off microphone 336.

As with the arrangement of FIG. 28, the arrangements of FIGS. 30 and 31may, if desired, be configured so that disruptions to the microphonesignals on the microphone line are avoided. This may be accomplished byomitting or avoiding the use of switches such as switch S0 that shortthe microphone and ground lines together when pressed. Although suchswitches may be helpful in controlling legacy devices, in situations inwhich the microphone and ground lines are in use to carry audio signalssuch as voice signals captured from a microphone during a telephonecall, the use of such momentary shorting switches may cause pops,clicks, and dead time. When switch S0 is omitted or not used, thesedisruptions to the microphone signals may be avoided.

Audio disruptions can also be avoided by the use of ultrasonic tones toconvey button press information, because ultrasonic tones are notaudible to humans and therefore do not create audible interference whencarried over the microphone line. At the same time that ultrasonicbutton press information is being conveyed from the accessory to theelectronic device over the microphone line and at the same time that theelectronic device is supplying a DC bias for the microphone over themicrophone line, the microphone line may be used to convey audioinformation from the accessory to the electronic device withoutinterference.

FIG. 29 shows the behavior of switches SWA, SWB1, and SWB2 in circuitsof the type shown in FIG. 31 in response to high and low latch outputvalues. When an appropriate accessory is present, such as a headset withspeakers and an active microphone, the accessory may be placed in tonemode by setting switch SWA off and by turning switches SWB1 and SWB1 on,as indicated in the first row of the table of FIG. 29. The second row ofthe FIG. 29 table indicates that the same type of accessory may beplaced in a resistance detection mode in which only direct detection ofthe states of resistively encoded switches S1-S4 is being performed bydevice 12, by taking the latch state low. The same resistance detectionmode may be invoked when, for example, the accessory connected to device12 only has speakers and no microphone, as indicated in the third row ofthe table of FIG. 29. The fourth row in the FIG. 29 table indicates thestates into which the switches SWA, SWB1, and SWB2 may be placed when itis desired to operate in tone mode to accommodate an accessory withspeakers but without a microphone.

Any suitable technique may be used to communicate using ultrasonictones. With one suitable arrangement, each button (e.g., each of theresistively encoded switches S1, S2, S3, and S4 in the FIG. 31 example)may be associated with a unique ultrasonic tone frequency. A calibrationfrequency and a button release frequency may also be used. Duringpower-up, an acknowledgement tone may be transmitted. Theacknowledgement tone, which may be provided in conjunction with acalibration tone, may be provided at any suitable frequency that may beproduced by tone generator 318 (e.g., at a frequency different from thatof the calibration frequency, at a frequency lower than that of thecalibration frequency, at a frequency independent of any button pressfrequency, at a frequency different from the button release frequency,at a frequency that is the same as one of the button frequencies or thebutton release frequency, at a frequency that is used only foracknowledgements, using multiple acknowledgement frequencies in the formof a code such as a code formed of three 2 ms tones each of a differentfrequency, using other sequences of more than one tone frequency, usingtone frequency sequences containing tones of different lengths, etc.).

Illustrative tones that may result from typical button activity areshown in FIG. 32. At time t_(a), a user may depress a button. Tonegenerator 318 may transmit a calibration frequency at time t_(a) fortime period t₁ (e.g., for 1 ms). After the calibration frequencytransmission is complete, tone generator 318 may transmit a toneassociated with the button actuated by the user. This tone may betransmitted starting at time t_(b) and may have a duration of t₂ (e.g.,2 ms). When the user releases the button at time t_(c), anothercalibration tone may be transmitted for duration t₃ (e.g., 1 ms). Thismay be followed by an ultrasonic tone at time td of duration t₄ thatindicates that the button has been released. Tone generator 318 maygenerate these tones from a clock in accessory 14 (e.g., by dividing a 2MHz local clock to obtain an appropriate ultrasonic frequency). Typicalultrasonic frequencies for the tones produced by tone generator 318 maybe, for example above 20 kHz (to avoid interference with audio signalson the microphone line) and below about 1 MHz (to avoid noise issues andto ensure proper transmission of the signals along the wires of theaccessory). Illustrative ranges for suitable tone frequencies include 25kHz-1 MHz, 25-500 kHz, 50-500 kHz, and 75-300 kHz (as examples). Higherfrequencies may be used for the ultrasonic tones if desired. Lowerfrequencies may be used when, for example, the presence of an audio toneon the microphone line is acceptable to the user.

The use of the clock in accessory 14 to generate the tones for tonegenerator is represented schematically by the clock CLK in tonegenerator 318 of FIG. 31. If desired, other arrangements may be used(e.g., by synchronizing the clocks of device 12 and accessory 14). Anadvantage of using unsynchronized clocks is that this may reduce designcomplexity and lower costs.

A table showing illustrative frequency assignments that may be used forthe ultrasonic tones is presented in FIG. 33. If more buttons are used,unique ultrasonic tones may be assigned to those buttons if desired.

FIG. 34 shows illustrative tone detector circuitry such as tone detector246 of FIG. 21 that may be used in processing received ultrasonic tonesin device 12. As shown in FIG. 34, tone detector 246 may receive anoscillating signal such as a sawtooth or sinusoidal signal over path 16(e.g., across microphone line M and ground G). This signal may beconverted to a square wave signal using limiter circuit 342. Tonedetector 246 may use pulse counting circuitry 346 to process theincoming tones. Counter circuitry 348 such as registers that maintaincount values may be used by pulse counting circuitry 346 to analyzereceived tones. Pulse counting and timing circuitry 346 may by clockedusing a device clock on input 350 that is local to device 12 and thatruns asynchronously with respect to the clock CLK in accessory 14.

The use of the calibration tones transmitted by tone generationcircuitry 318 and the pulse counting and timing circuitry 346 of tonedetector 246 may allow ultrasonic tone communications to be usedreliably, even in environments in which the clocks of device 12 andaccessory 14 are asynchronous.

An illustrative processing approach that may be used by tone detector246 in analyzing incoming ultrasonic tones is shown in FIG. 35. As shownin the top portion of FIG. 35, tone detector may initially receive abutton tone at the calibration frequency (i.e., a tone corresponding totime t_(a) of FIG. 32). The pulses of the calibration tone can becounted to a count value of N1 (e.g., a predetermined value such as 64in the FIG. 35 example). This first counting process establishes awindow size WS. As shown in the middle portion of FIG. 35, this windowsize may be measured in the clock domain of device 12 by simultaneouslycounting using the device clock. The count value reached by the deviceclock in window size WS may be referred to as count C1. After count C1has been established, the pulses of the button tone may be processed(i.e., the tone associated with the transmission of time t_(b) of FIG.32 or, in the case of a button release event, the transmissionsassociated with time td). As shown in the lower portion of FIG. 35, thebutton tone processing operation may involve counting the pulses of theunknown tone for a duration equal to time window WS. The length of timewindow WS can be determined by counting with the device clock to countvalue C1 (or counting down from C1 with the device clock). The resultingcount N2 for the unknown pulse can then be compared to the calibrationcount N1. The ratio of N2 to N2 represents a calibrated version of thetransmitted ultrasonic tone and can be compared to the entries in atable of known values such as the table of FIG. 33 to identify thebutton activity that has occurred in accessory 14.

Illustrative steps involved in this type of tone detection procedure areshown in FIG. 36. At step 352, tone detector circuitry in device 12 suchas tone detector 246 of FIG. 34 may begin receiving a calibration tone(e.g., at time t_(a) of FIG. 32).

At step 354, counting circuitry 346 may count to N1 cycles (e.g., aknown number of cycles such as 64 cycles). Timing circuits in circuitry346 may be used to start the counting process within the middle portionof the t₁ duration of the calibration pulse. The counting processestablishes time window WS. At the same time that counting circuitry 346is counting to N1 pulses of the incoming tone, the device clock is beingused to keep track of a count value C1 corresponding to the number ofdevice clock pulses during window WS. The value of N1 and the value ofC1 that is reached when counting the device clock pulses until the countN1 of the incoming tone pulses is reached may be stored in countregisters 348.

At step 356, tone detector 246 may start receiving the button tone(i.e., the ultrasonic tone of time t_(b) or time td of FIG. 32). Thismay correspond to a button press or button release event (as examples).

At step 358, the time window WS may be reconstructed by counting to thevalue of C1 using the device clock. At the same time that the deviceclock is being used to recreate time window WS, tone detector 246 mayuse pulse counting circuitry 346 to count the number N2 of pulses in theincoming tone.

The values of N1 and N2 may be used to identify the button tone at step360. In particular, tone detector 246 or other suitable processingcircuitry may compute the value of N2/N1, which represents thecalibrated version of the transmitted ultrasonic tone. The calibratedversion of the transmitted tone may then be used in conjunction with atable of the type shown in FIG. 33 to identify the type of buttonactivity that has been detected. Techniques such as this may also beused to detect tones that have been transmitted from device 12 toaccessory 14 (e.g., in system such as those described in connection withFIG. 7 in which tones may be transmitted bidirectionally). As indicatedschematically by line 362, the operations of steps 352, 354, 356, 358,and 360 may be repeated to process additional button actuation events.

As described in connection with FIG. 23, electronic devices andaccessories of different configurations may be used together. In thistype of environment, it may not be known in advance which capabilitiesare present in the electronic device and accessory. A discovery processmay therefore be used to ascertain the capabilities of components insystem 10. For example, device 12 may perform accessory identificationoperations to determine which type of accessory 14 is connected todevice 12 and which circuitry in accessory 14 is available for use.Discovery operations may be performed, for example, whenever a newaccessory is connected to device 12, upon launching applications thatare running on device 12, when initiated by a user, or at any othersuitable time.

Steps involved in an illustrative accessory identification process thatmay be used by electronic device 12 to ascertain the capabilities of anaccessory that has been connected to the device are shown in FIG. 37.

At step 364, as device 12 awaits insertion of the audio plug of theaccessory (e.g., a headset, adapter, or other accessory equipment),device 12 may ground microphone terminal M. For example, in power supplycircuitry 180 of FIG. 25, device 12 may close switch SW4 to short themicrophone terminal M to ground. Electronic device 12 may have a sensorsuch as a mechanical switch (e.g., mechanical switch SWM of FIG. 24)that is tripped when the audio plug of accessory 14 is inserted into themating audio jack of electronic device 12. During step 364, device 12may monitor the state of the mechanical switch. When the user insertsthe plug of the accessory into device 12, the presence of the plug maybe reflected by a change in the electrical state of the mechanicalswitch. This allows device 12 to detect the presence of the accessory(step 366). Once the insertion of the accessory plug has been detected,device 12 may initiate accessory identification operations.

At step 368, device 12 may, if desired, wait for a predetermined amountof time (e.g., 300 ms) to ensure that the user has fully inserted theaccessory audio plug into the audio jack of device 12.

At step 370, device 12 may activate its tone detection capabilities(e.g., using tone detector 246).

At step 372, device 12 may use power supply 180 to adjust the biasvoltage on microphone line M. Device 12 may, for example, set the outputvoltage of power supply 180 to a nominal value of 2.7 volts. The use ofa 2.7 volt bias to bias microphone in accessories may be advantageous,because this bias voltage may be compatible with a relatively wide rangeof microphone types. Nevertheless, the 2.7 bias voltage that isgenerated in the illustrative operations of step 372 is merely anexample. Other bias voltage levels may be used if desired.

The 2.7 volt DC bias voltage (or other suitable voltage) that issupplied by power supply circuit 180 of device 12 may serve as a controlsignal for accessory 14. Accessories such as accessory 14 of FIG. 31 mayhave voltage detector and latch circuitry 320 that is responsive to theamount of applied voltage on microphone contact M. As a result,accessory 14 may be directed to take various actions by applyingparticular DC bias voltages or sequences of DC bias voltages on line M.

With one suitable arrangement, voltage detector and latch circuitry 320may place the circuitry of accessory 14 in tone mode at step 374 when abias voltage is detected on line M that is greater than a particularthreshold (e.g., a 2.3 volt threshold voltage). For example, voltagedetector and latch circuitry 320 may respond to received voltages online M that exceed the threshold voltage by opening switch SWA andclosing switches SWB1 and SWB2. In accessories with tone mode andmicrophone capabilities, such as accessory 14 of FIG. 31, this willactivate the microphone circuitry and will disconnect the resistivelyencoded switches from the microphone line so that button activity willbe conveyed to device 12 as tones, rather than as changes in microphoneline to ground line resistances.

To ensure that device 12 and accessory 14 work properly together, it maybe desirable for accessory 14 to send confirmation information to device12 in response to detection of the 2.7 volt DC bias from device 12.Confirmation information may be provided, for example, in the form of anacknowledgement signal. In arrangements of this type, device 12 mayawait an acknowledgement signal from accessory 14 at step 376.

Device 12 may maintain a local timer. The TX ACK bit in the registers ofcontrol circuitry 274 (FIG. 27) may be set high to set the local timer(e.g., to start an appropriate timeout period of 6 ms). The timer may beinitialized after raising the output voltage from power supply 180 to2.7 volts or other voltage that is expected to elicit an acknowledgementfrom accessory 14. If no acknowledgement is received from accessory 14at tone detector 246 within the predetermined timeout period (e.g., 6ms), device 12 may conclude that accessory 14 does not have properlyoperating tone-based acknowledgement capabilities, may set the registersof control circuitry 274 to reflect this status, and may generate acorresponding interrupt on line 282 (FIG. 24) to indicate that the timerhas expired without receive of an acknowledgement from accessory 14(step 378). Software running on device 12 (e.g., an application that maydesire to use the buttons of an accessory) may query the registers ofcontrol circuitry 274 to determine why the interrupt was generated(i.e., to discover that the interrupt was generated because the timerexpired without receiving an acknowledgement from the accessoryindicating that tone capabilities were present).

At step 380, device 12 may use comparator 186 of voltage detectioncircuitry 216 (FIG. 26) to determine whether microphone line M andground G are shorted together.

If contacts M and G are shorted together, device 12 may verify thiscondition at step 388. If a user inserts the audio plug of accessory 14into the mating audio jack in device 12 slowly, the microphone andground contacts M and G may be momentarily shorted due to inadvertentmomentary contact between the contacts in the plug and metal portions ofthe jack. During step 388, comparator 186 may again be used to determinewhether the microphone and ground lines are shorted or whether the shortdetected at step 380 was only momentary (e.g., due to a partial pluginsertion).

If, at step 380, it was determined that the microphone contact M andground G were not shorted together, switch 300 in voltage detectioncircuit 216 may be adjusted to set VR to an appropriate level (e.g., 2.5volts) to detect whether a microphone is present in the accessory. Atstep 382, voltage detection circuit 216 may be used to determine whetherthere is a microphone present in the accessory. If there is nomicrophone in the accessory (e.g., because the user has inserted anextension cable into the jack), the voltage on microphone terminal Mwill remain near 2.7 volts (i.e., greater than 2.5 volts). If, however,there is a microphone present in the accessory, current drawn throughthe microphone will pull the voltage on terminal M below 2.5 volts. Thisreduced voltage will be detected by comparator 312 (FIG. 26), confirmingthe presence of the microphone.

If it is determined at step 382 that a microphone is present, device 12can conclude that the accessory has a microphone and no tone modecapabilities. For example, device 12 may conclude that the accessory isa headset with a shorting button 176 and a microphone 174 of the typeshown in FIG. 11. This may be verified during the operations of step384. For example, control circuitry 274 use power supply 180 to set itsoutput voltage to 0 volts and, subsequently, to 2.0 volts (as anexample). When this procedure is followed, accessories such as thetone-mode enabled accessory 14 of FIG. 31 will not enter tone mode,because the microphone line bias voltage (e.g., 2.0 volts) will not riseabove the threshold associated with voltage detector and latch 320(e.g., 2.3 volts). The accessory will therefore not be placed in tonemode and the microphone line will not be pulled low. In this situation,the “microphone detect true” bit in the register circuitry of FIG. 27will not be set. On the other hand, in accessories such as headsets ofthe type shown in FIG. 11, raising the voltage to 2.0 volts will resultin a measured microphone line voltage of about 2.0 volts and will causethe “microphone detect true” bit to be set by control circuitry 274(FIG. 24). If device 12 reaches step 384 and verification is successful,device 12 can conclude that accessory 14 is of the type shown in FIG.11.

If it is determined at step 382 that no microphone is present inaccessory 14, device 12 may direct power supply 180 to bias themicrophone line M in accessory 14 at 2.7 volts (step 386). Accessory 14,which may be a headset with resistively encoded buttons of the typeshown in FIG. 14, may be used to control device 12.

If it is determined at step 380 that the microphone line is shorted,verification operations may be performed at step 388. For example, thestate of output 192 of comparator 186 in voltage detection circuitry 216may be checked to ensure that the voltage on line 190 is below VREF(i.e., below 0.2 volts). If verification operations at step 388 aresuccessful, device 12 may conclude that accessory 14 is a headset of thetype shown in FIG. 9 having a plug such as plug 36 of FIG. 4 with asleeve 64 that is shorting regions 78 and 80 of jack 38 in device 12.

If, at step 376, an acknowledgement tone signal is successfully detectedwithin the acknowledgement time window (e.g. 6 ms), processing mayproceed to step 390. During the operations of step 390, device 12 mayset a register in control circuitry 274 to reflect that theacknowledgement signal has been received from accessory 14 and maygenerate an interrupt. The processing circuitry of device 12 may, inresponse to the interrupt, conclude from the contents of the registercircuitry that confirmation information from accessory 14 has beensuccessfully received (i.e., because the tone generator 318 of accessory14 transmitted an acknowledgement tone to confirm the presence of tonemode capabilities in accessory 14 in response to the operations of step374).

At step 392, device 12 can determine whether a microphone is present inaccessory 14. Voltage detection circuitry 216 may be used to evaluatethe voltage on microphone terminal M. If a microphone is present, thevoltage on terminal M will be relatively low due to the current drawn bythe microphone. In this situation, device 12 may conclude that accessory14 is of the tone-mode-capable type shown in FIG. 31 and has amicrophone. If no microphone is present, the voltage on terminal M willbe relatively high and device 12 can conclude that accessory 14 is ofthe type shown in FIG. 31, but without a microphone present.

As this example demonstrates, the various DC voltages produced by powersupply 180 in device 12 can serve as control signals for accessory 14.Accessory 14 can detect these DC voltages and can respond. In “smart”accessories that support tone-mode functions, tone generation circuitrymay be used to send confirmatory information to device 12 (e.g., in theform of an ultrasonic acknowledgement tone). Voltage detection circuitryin device 12 may then be used to determine whether the accessory has amicrophone. In accessories that do not support advanced tone-modefunctions, device 12 can use tone detector 246, power supply circuitry180, and voltage detector circuitry 216 to analyze the accessory anddetermine its capabilities.

Once the discovery process is complete, an application such as a mediaplayback application, cellular telephone application, operating systemfunction, or other suitable software implemented on device 12 can takeappropriate action. For example, if it is determined that no tone modecapabilities are present, device 12 can operate in resistance detectionmode (if resistively encoded buttons are present) or can await buttonpresses from a shorting button such as button 176. If it is determinedthat no microphone is present, certain functions may be blocked (e.g.,functions requiring the user's voice). Other functions may not beblocked (e.g., functions associated with media playback operations). Ifdesired, applications in device 12 may change the operating mode ofdevice 12. For example, an application running on device 12 might placedevice 12 in a resistance detection mode when microphone functions arenot needed, thereby potentially saving power, even if device 12 has tonemode capabilities. During resistance detection mode, button pressescreate changes in the impedance between microphone line M and ground Gthat could be disruptive if a microphone were in active use. Theresistance detection mode is therefore generally preferred only when themicrophone is not being used. In situations in which the microphone isbeing used or in which tone mode operations consume less power, tonemode operation may be preferred.

Any suitable applications may be implemented on device 12. For example,device 12 may run software that handles functions associated with wiredand wireless communications, games, productivity, finance,entertainment, media, and other functions. Illustrative applicationsthat may be implemented on processing circuitry 128 of device 12 andthat may use the functionality of accessory 14 in system 10 includemedia player applications, radio applications, voice memo applications(e.g., applications that include recording functionality for voice orother sounds), voice or other sound recording playback applications, andexercise applications (e.g., applications that perform fitness-relatedfunctions such as keeping track of fitness information, playing media ina way that is suitable when a user is jogging or is working out at afitness facility, etc.). These applications may be implemented usingprocessing circuitry 128 of FIG. 7 (as an example).

During normal operation of device 12 and accessory 14, user input suchas button press activity information may be conveyed from accessory 14to device 12 in real time. Processing circuitry 128 may analyze the userinput and take appropriate actions. The actions that are taken by device12 in response to particular user input generally depend on whichsoftware is operating on device 12. For example, device 12 may always ornearly always run an operating system, so user input related tooperating system control functions may be processed continuously ornearly continuously. Other user input may result in different actions,depending on context. For example, selection of a “+” button may resultin a track skip operation if a user is interacting with a media playbackapplication in a particular mode of operation, whereas selection of thesame “+” button may result in an increase in volume for the audio beingdriven into accessory 14 when the user is interacting with a cellulartelephone application.

To simplify operations, it may be desirable to limit the range ofallowable button presses that can be made by a user. In this type ofarrangement, multiple button clicks within a short period of time oruser button activity involving simultaneous selection of two buttons maybe ignored. With other suitable arrangements, more complex buttonactivity may be allowed (e.g., multiple button clicks, selection ofmultiple buttons, etc.).

If desired, multiple button presses may be handled as follows (as anexample). Initially, device 12 can note which button was pressed upondetection of a first button press from the user. If a second buttonpress is detected before a button release tone is received, the secondbutton press may be ignored. On any button release when a button isactive, device 12 may assume that a release of the pressed button wasintended.

Collections of one or more button presses may sometimes be referred toas multi-button commands or user gestures. FIG. 38 presents a table ofillustrative user commands that may be associated with the user inputinterface on accessory 14. In the examples of FIG. 38, the userinterface has been assumed to include three buttons: a “+” button, acenter button, and a “−” button, as described in connection with FIG. 5.This is, however, merely illustrative. Any suitable number of buttonsmay be used on accessory 14 to gather user input if desired.

As shown in the table of FIG. 38, user gestures may involve selection ofparticular buttons and timing information. When selecting buttons, auser may select a single button, two buttons, or more than two buttons.With respect to timing, a user has several options. For example, a usermay press and immediately release a button (sometimes referred to as a“click”). The user may also press and hold the button for an extendedperiod of time (e.g., for a fraction of a second or more than a second).Another possibility relates to multiple selections of the same button.In this type of situation, the user might, for example, press andrelease the same button twice in rapid selection (sometimes referred toas a “double click”). Triple clicks or even more complex clickingpatterns may also be recognized (e.g., to select a previous track).Moreover, combinations of single button presses, multiple buttonpresses, single and double clicks, and hold events may be used as usergestures if desired. As just one example, a double-click and holdcommand may be recognized as a unique user gesture by device 12 in avoice recording application, as indicated by the last column of thetable of FIG. 38.

The table of FIG. 38 lists several illustrative applications that may beimplemented on electronic device 12 such as a media player application,a radio application, a voice memo record application, a voice memoplayback application, and an exercise application. These are merelyillustrative applications that may be implemented on device 12. Ingeneral, any suitable applications may be run on the hardware of device12 such as business productivity applications, games, communicationsapplications, entertainment applications, etc. The user gestures thatare shown in FIG. 38 are also merely illustrative. For example, othercombinations of user inputs may be made using buttons in accessory 14.If desired, user commands may be formed partly using button actuationevents and partly using other user input (e.g., sound). For example, auser may supply a voice command while performing a click and holdoperation. User input based solely on voice commands or other non-buttoninput may also be provided.

As each user command is entered (e.g., using a user gesture composed ofbutton actuation events), a specific corresponding set of ultrasonictone signals is transmitted to electronic device 12 over the audio jack.Clicks may be represented by distinct ultrasonic tones, depending onwhich button was pressed. Holds may be represented by repeatedtransmission of button-specific ultrasonic tones or by special “hold”tones. Still other arrangements may be used in which, for example, adouble click is represented by a particular tone and a triple click isrepresented by another tone. Different commands may be represented bytones of different corresponding frequencies or commands may berepresented using codes made up of multiple tones of differentfrequencies, different tone patterns, different tone durations, etc.

Schemes such as these in which different complex user gestures areconverted into particular tones or tone-based codes are generally moreburdensome on the processing circuitry of accessory 14 than schemes inwhich each button press results in corresponding unique ultrasonictones. For this reason, it may be desirable to use an arrangement inwhich each button press that is detected (e.g., by an impedancedetector) results in the production of a corresponding ultrasonic toneby the ultrasonic tone generator. However, schemes in which more buttonand other user input processing is performed at accessory 14 beforetransmitting instructions to device 12 as ultrasonic tone informationmay be used if desired.

Although unique user inputs typically result in unique instructions fordevice 12, identical commands can result in different actions. This isbecause the actions taken by electronic device 12 typically depend oncontext, as illustrated by FIG. 38. If, for example, a user is operatinga media player application, a click of the center button will pausemedia playback, whereas a click of the center button will mute radioplayback if a radio application is active. The ultrasonic tones that aresent to the electronic device in response to user input on the accessoryform specific instructions for the electronic device. When theelectronic device receives these instructions over the audio jack, theaction taken by the electronic device typically depends on whichsoftware applications are operating on the device.

Additional user gestures that may be used in system 10 are shown in FIG.39. As shown in FIG. 39, volume up and down operations and a play/pauseoperations may be controlled using button clicks. Additional functionsmay be controlled using gestures such as a click and hold gesture, adouble-click gesture, a gesture formed by making a click followed by aclick and hold, or a triple click gesture. The functions that arecontrolled in this way may be, for example, media playback functionssuch as music playback functions, playlist navigation functions, etc.

When a headset that has a single button and a microphone or a singlebutton but no microphone is used, electronic device 12 may recognizecenter button presses and can distinguish between click, click & hold,double click, click+click & hold, and triple click gestures.

When a headset that has three buttons and a microphone or a headset withthree buttons and no microphone is used, electronic device 12 mayrecognize button presses from the volume up (V+), center, and volumedown (V−) buttons, may distinguish between click, click & hold, doubleclick, click+click & hold, and triple click gestures, and may recognizeand ignore multiple simultaneous button presses.

If desired, distinguishable audio feedback for different button pressesmay be generated by electronic device 12 and played for the user.

During media playback, an accessory with three buttons may allow theuser to increase the playback volume. Clicking once on the V+ button mayincrement the volume one step and a press and hold of the V+ button maycause the playback volume to ramp up. The user may reduce the playbackvolume by clicking once on the V− button to decrement the volume onestep. The user may press and hold the V− button to cause the volume toramp down.

Play and pause operations may be performed using the center button.Clicking once on the center button will cause the media playback topause if media was playing and resume if media playback was paused.

Media playback may also be advanced. In particular, double-clicking onthe center button on accessory 14 will produce a “next” command toadvance media playback to a next song, chapter, or photo.

Playlists may be navigated using user gestures. For example, a click &hold gesture using the center button will advance a user to the nextplaylist. If there is only one playlist present, a click & hold of thecenter button will not result in any action being taken. If a click &hold gesture is made while on the last of a list of playlists,electronic device 12 will advance to the first playlist in the list.

FIG. 40 shows illustrative circuitry that may be used in an accessorysuch as accessory 14 when the microphone is omitted. Accessories of thetype shown in FIG. 41 may be used with electronic devices that do nothave cellular telephone capabilities or other functions that usemicrophone signals or may be used in a reduced-functionality mode with acellular telephone or other such device that contains microphone signalprocessing circuitry.

If desired, potential interference with microphone signals can beavoided using an accessory of the type shown in FIG. 41. In this type ofarrangement, the momentary shorting button S0 that might otherwise beconnected between the microphone and ground lines has been omitted. As aresult, button press events do not result in shorts between themicrophone and ground lines. The microphone line is therefore notdisrupted, even if buttons are pressed repeatedly while the microphoneline is in use to control the electronic device. Moreover, ultrasonicsignals may be supplied by tone generator 318, so that button press datais transmitted using frequencies out of the normal range of humanhearing. This makes button data transmission operations inaudible tousers of accessory 14, even though the tone data is transmitted over themicrophone line.

The foregoing is merely illustrative of the principles of this inventionand various modifications can be made by those skilled in the artwithout departing from the scope and spirit of the invention.

1. An accessory that communicates with an electronic device over a wiredcommunications path that includes an audio connector connected to wiresin the wired communications path, comprising: at least one speaker thatreceives analog audio signals from the electronic device through thewires and the audio connector, wherein the audio connector is connectedto the accessory and comp rises a four-contact audio plug including atip contact, two ring contacts, and a sleeve contact; an ultrasonic tonegenerator that supplies ultrasonic signals to a pair of the wires,wherein the pair of wires includes a microphone wire and a ground wire;a microphone that supplies audio signals to the microphone and groundwires; resistively encoded buttons that gather user input from a userfor transmission to the electronic device using the ultrasonic signals;an impedance detector that gathers resistance information from theresistively encoded buttons while at least one of the resistivelyencoded buttons is being actuated by a user, wherein the resistanceinformation is indicative of the user input; voltage detector and latchcircuitry that measures voltages across the microphone and ground wires,wherein the voltage detector and latch circuitry produces an outputsignal; and switching circuitry that is controlled by the output signal,wherein the switching circuitry comprises switches that may be placedinto a first configuration by the output signal when it is desired tooperate the accessory in a tone mode in which the ultrasonic signalsconvey the user input to the electronic device and that may be placedinto a second configuration by the output signal when it is desired tooperate the accessory in a resistance detection mode in which theelectronic device gathers the resistance information from theresistively encoded buttons without using the impedance detector. 2.(canceled)
 3. The accessory defined in claim 1 wherein the microphonecomprises a microelectromechanical systems module containing anamplifier and a microphone unit.
 4. The accessory defined in claim 1wherein the microphone comprises an electret microphone.
 5. (canceled)6. (canceled)
 7. The accessory defined in claim 1 wherein the ultrasonictones on the pair of wires do not disrupt the audio signals on the pairof wires. 8-15. (canceled)
 16. The accessory defined in claim 1 furthercomprising a user-controllable switch that bridges the microphone andground lines to momentarily short the microphone and ground linestogether.
 17. The accessory defined in claim 1 further comprising: ashunt regulator that regulates voltages applied to the microphone usingpower from the electronic device.
 18. The accessory defined in claim 1further comprising: a shunt regulator that regulates voltages applied tothe microphone using power from the electronic device and that powersthe ultrasonic tone generator.
 19. The accessory defined in claim 1further comprising: a shunt regulator that powers the ultrasonic tonegenerator. 20-24. (canceled)
 25. A headset that operates with anelectronic device that may be connected to the headset using a wiredcommunications path, the headset comprising: speakers; a microphone;buttons that receive user input from a user, wherein the buttonscomprise at least three resistively encoded buttons; a cable havingright and left speaker wires, a microphone wire, and a ground wire;control circuitry including an ultrasonic tone generator that receivesthe user input; an audio plug having a tip contact, a first ringcontact, a second ring contact, and a sleeve contact, wherein the tipcontact, the first ring contact, and the ground wire are used to receiveaudio signals from the electronic device for the speakers, wherein themicrophone wire and ground wire are connected to the sleeve contact andthe second ring contact and are used to convey audio signals from themicrophone to the electronic device, and wherein the ultrasonic tonegenerator transmits ultrasonic tones to the electronic device over themicrophone wire and ground wire to provide the user input to theelectronic device; an impedance detector that measures resistance valuesassociated with user actuation of the resistively encoded buttons todetermine which of the resistively encoded buttons has been actuated bythe user; and switching circuitry that switches the headset between afirst mode and a second mode, wherein: when the headset is in the firstmode, the resistance values are measured by the electronic device overthe microphone and ground lines; and when the headset is in the secondmode, the resistance values are measured by the impedance detector andthe user input is conveyed to the electronic device using the ultrasonictones.
 26. A headset that operates with an electronic device that may beconnected to the headset using a wired communications path, the headsetcomprising: speakers; a microphone; buttons that receive user input froma user, wherein the buttons comprise at least three resistively encodedbuttons; a cable having right and left speaker wires, a microphone wire,and a ground wire; control circuitry including an ultrasonic tonegenerator that receives the user input; an audio plug having a tipcontact, a first ring contact, a second ring contact, and a sleevecontact, wherein the tip contact, the first ring contact, and the groundwire are used to receive audio signals from the electronic device forthe speakers, wherein the microphone wire and ground wire are connectedto the sleeve contact and the second ring contact and are used to conveyaudio signals from the microphone to the electronic device, and whereinthe ultrasonic tone generator transmits ultrasonic tones to theelectronic device over the microphone wire and ground wire to providethe user input to the electronic device; and an impedance detector thatmeasures resistance values associated with user actuation of theresistively encoded buttons to determine which of the resistivelyencoded buttons has been actuated by the user, wherein the ultrasonictone generator is configured to transmit a calibration ultrasonic tonewhen the user actuates one of the resistively encoded buttons.
 27. Aheadset that operates with an electronic device that may be connected tothe headset using a wired communications path, the headset comprising:speakers; a microphone; buttons that receive user input from a user,wherein the buttons comprise at least three resistively encoded buttons;a cable having right and left speaker wires, a microphone wire, and aground wire; control circuitry including an ultrasonic tone generatorthat receives the user input; an audio plug having a tip contact, afirst ring contact, a second ring contact, and a sleeve contact, whereinthe tip contact, the first ring contact, and the ground wire are used toreceive audio signals from the electronic device for the speakers,wherein the microphone wire and ground wire are connected to the sleevecontact and the second ring contact and are used to convey audio signalsfrom the microphone to the electronic device, and wherein the ultrasonictone generator transmits ultrasonic tones to the electronic device overthe microphone wire and ground wire to provide the user input to theelectronic device; an impedance detector that measures resistance valuesassociated with user actuation of the resistively encoded buttons todetermine which of the resistively encoded buttons has been actuated bythe user; and a latch that is responsive to voltage biases supplied overthe cable to the headset by the electronic device. 28-34. (canceled) 35.A method of using a headset that operates with an electronic device thatmay be connected to the headset using a wired communications path,comprising: receiving audio signals over the wired communications pathand playing the audio signals through speakers in the headset; gatheringmicrophone signals with a microphone in the headset, gathering userinput from a user with buttons in the headset; with ultrasonic tonegeneration circuitry in the headset, transmitting the user input to theelectronic device as ultrasonic tones over a pair of wires in the wiredcommunications path while simultaneously transmitting the microphonesignals to the electronic device over the pair of wires; with impedancedetector circuitry in the headset, determining which of the buttons hasbeen pressed by the user; and with switching circuitry in the headset,switching the headset between a tone mode of operation in which theultrasonic tones convey the user input to the electronic device and aresistance detection mode in which resistance values associated with thebuttons are measured over the wired communications path.